Repository navigation
feat(phase-1): allow user to customize keybindings - #7163
Conversation
|
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:
WalkthroughAdds a full in-app keybindings editor with validation and OS-aware merging, centralizes hotkey lifecycle in a refactored HotkeysProvider, expands default key mappings and Electron zoom IPC/menu, augments sidebar keyboard handlers, and adds extensive Playwright tests and small test-id tweaks. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant UI as "Keybindings Editor (Renderer)"
participant Validator as "Validation Logic"
participant Prefs as "Preferences Store"
participant Hotkeys as "HotkeysProvider"
participant Mousetrap as "Mousetrap"
User->>UI: Edit/save keybinding
UI->>Validator: Validate combo (reserved, OS rules, duplicates)
Validator-->>UI: Validation result
alt valid
UI->>Prefs: Persist custom binding
Prefs-->>Hotkeys: Preferences updated
Hotkeys->>Hotkeys: Merge defaults + user bindings
Hotkeys->>Mousetrap: Convert to mousetrap combos and bind/unbind
Mousetrap-->>UI: Hotkey active
else invalid
UI-->>User: Show error tooltip
end
sequenceDiagram
actor User
participant Menu as "Electron Menu"
participant Main as "Main Process"
participant Renderer as "Renderer Process"
User->>Menu: Click "Zoom In"
Menu->>Main: Invoke click handler (access focused BrowserWindow)
Main->>Main: Adjust webContents zoom (+0.5)
Main->>Renderer: (IPC or webContents) apply zoom change
Renderer-->>User: UI zoom changed
sequenceDiagram
participant Hotkeys as "HotkeysProvider"
participant EventBus as "Window Event Bus"
participant Collection as "Collection Component"
Hotkeys->>EventBus: Emit 'clone-item-open'
EventBus->>Collection: Event dispatched
Collection->>Collection: Check isFocusedRef
alt focused
Collection->>Collection: Open clone modal
else not focused
Collection-->>Hotkeys: Ignore event
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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: 18
🧹 Nitpick comments (7)
packages/bruno-app/src/providers/Hotkeys/keyMappings.js (1)
128-148:getMergedKeyBindingsis recomputed on every call togetKeyBindingsForActionAllOS.Each action lookup triggers a full merge of all bindings. In the Hotkeys provider (which calls
getKeyBindingsForActionAllOSper action), this means N full merges for N actions. Not a blocking issue at the current scale, but worth noting if the action list grows.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/providers/Hotkeys/keyMappings.js` around lines 128 - 148, getKeyBindingsForActionAllOS currently calls getMergedKeyBindings on every invocation causing O(N^2) work when the Hotkeys provider asks per-action; fix by computing the merged bindings once and reusing them: either change the Hotkeys provider to call getMergedKeyBindings(userKeyBindings) once and pass the resulting merged object into getKeyBindingsForActionAllOS (add a new parameter like mergedBindings) or memoize getMergedKeyBindings (e.g., cache by reference or userKeyBindings identity) so repeated calls return the same merged object; update references to getKeyBindingsForActionAllOS and any calls from the Hotkeys provider to use the new parameter or rely on the memoized result.packages/bruno-electron/src/store/preferences.js (1)
60-104:keyBindingsdefaults duplicated across electron store and app-sidekeyMappings.js.The exact same binding definitions exist in
packages/bruno-app/src/providers/Hotkeys/keyMappings.js(DEFAULT_KEY_BINDINGS). If a new action is added or a default shortcut changes, both files must be updated in lockstep — a classic DRY violation.Consider extracting the default keybindings into a shared package/module and importing from both sides.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-electron/src/store/preferences.js` around lines 60 - 104, Duplicate default key bindings exist between keyBindings (in preferences.js) and DEFAULT_KEY_BINDINGS (in keyMappings.js); extract them to a single shared module and import from both places. Create a shared export (e.g., defaultKeyBindings) containing the same shape (platform keys mac/windows and name) and replace the inline object in preferences.js (keyBindings) and the app-side DEFAULT_KEY_BINDINGS to import that shared symbol; ensure function/class references that consume these values (e.g., anywhere expecting keyBindings or DEFAULT_KEY_BINDINGS) still receive the same object shape and update any TypeScript types or tests to reference the new module.packages/bruno-app/src/components/Preferences/Keybindings/index.js (2)
186-201: Redundant guard onDEFAULT_KEY_BINDINGS.Line 189:
DEFAULT_KEY_BINDINGSis a module-level constant object — this check is always truthy and adds no value. It's also placed aftergetDefaultRowKeysString(action)has already dereferenced it on line 188.Suggested fix
const isRowDirty = (action) => { const current = getCurrentRowKeysString(action); const def = getDefaultRowKeysString(action); - if (!DEFAULT_KEY_BINDINGS) return false; return current !== def; };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` around lines 186 - 201, Remove the redundant runtime guard on DEFAULT_KEY_BINDINGS inside isRowDirty: delete the `if (!DEFAULT_KEY_BINDINGS) return false;` check (it’s a module-level constant and already dereferenced by getDefaultRowKeysString), so isRowDirty should simply compare getCurrentRowKeysString(action) !== getDefaultRowKeysString(action). Leave hasDirtyRows/useMemo as-is (it already iterates Object.keys(DEFAULT_KEY_BINDINGS)); if you want safety, perform any validation at module init rather than inside isRowDirty.
464-469: Orphan<Tooltip>— never anchored to any element.This
<Tooltip id="kb-editing-error-tooltip">has noanchorSelectprop, so it will never attach to or display next to any element. The per-row tooltips (lines 536–544) are the ones actually used. Remove this dead JSX.Suggested fix
- <Tooltip - id="kb-editing-error-tooltip" - place="bottom-start" - opacity={1} - className="kb-tooltip kb-tooltip--error" - /> -🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` around lines 464 - 469, Remove the orphan Tooltip JSX with id="kb-editing-error-tooltip" since it has no anchorSelect and is never attached; delete the <Tooltip id="kb-editing-error-tooltip" ... /> element (the standalone tooltip block) and ensure that only the per-row Tooltip instances (the tooltips used within each row) remain; also search for any references to "kb-editing-error-tooltip" and remove or update them if found.packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.js (1)
48-63:setTimeout+document.querySelectorfor focusing is fragile.If the search input takes longer than 50ms to mount, or if the class name
.collection-search-inputchanges, focus silently fails. Consider using a ref or a callback-based approach for more reliable post-render focus.That said, the event listener setup and cleanup are correct.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.js` around lines 48 - 63, The current handleSidebarSearch in useEffect relies on setTimeout + document.querySelector('.collection-search-input') which is fragile; replace this with a React ref/callback: create a ref (e.g., searchInputRef) or a focus callback in the CollectionsSection and pass it into the Search/Input component (rather than querying by class), call setShowSearch(true) as before, then in a useEffect/useLayoutEffect that depends on showSearch or in the input's ref callback, call searchInputRef.current.focus() (remove the setTimeout and DOM query). Update references to the class selector and the handleSidebarSearch logic so focusing is driven by the ref (preserve the event listener add/remove in useEffect).packages/bruno-app/src/providers/Hotkeys/index.js (2)
333-372:useSelectorsubscriptions for modal context cause unnecessary re-renders.
tabs,collections, andactiveTabUid(lines 334–336) are selected solely to derivecurrentCollectionfor theNewRequestmodal'scollectionUidprop. Every tab or collection state change triggers a re-render of the entire provider tree, even when no modal is open.Consider computing
currentCollectionlazily (e.g., inside the modal-open handler viastore.getState()) or wrapping the modal section in a separate component that subscribes independently.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/providers/Hotkeys/index.js` around lines 333 - 372, HotkeysProvider is subscribing to tabs, collections and activeTabUid (via useSelector) purely to derive currentCollection, causing unnecessary re-renders; remove those top-level selectors and stop computing currentCollection on every render in HotkeysProvider, and instead compute the collection lazily when opening the New Request modal (e.g., inside the handler that calls setShowNewRequestModal) using the redux store directly (store.getState()) or move the modal UI into a separate component (e.g., NewRequestModal) that calls useSelector for tabs/collections/activeTabUid itself; update getCurrentCollection/currentCollection usage accordingly so bindAllHotkeys and the provider render path no longer depend on tabs/collections/activeTabUid.
85-87: Static analysis:forEachcallback implicitly returns a value.Biome flags this because
unbindHotkeycan return the result ofMousetrap.unbind(). Harmless sinceforEachignores return values, but trivially fixable.Suggested fix
function unbindAllHotkeys(userKeyBindings) { - BOUND_ACTIONS.forEach((action) => unbindHotkey(action, userKeyBindings)); + BOUND_ACTIONS.forEach((action) => { unbindHotkey(action, userKeyBindings); }); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/providers/Hotkeys/index.js` around lines 85 - 87, The forEach callback in unbindAllHotkeys implicitly returns the value from unbindHotkey (which can return Mousetrap.unbind()), triggering static analysis; change the implementation to explicitly ignore the return value—e.g., replace the BOUND_ACTIONS.forEach(...) with an explicit loop (for (const action of BOUND_ACTIONS) { unbindHotkey(action, userKeyBindings); }) or wrap the call with void to discard the result—so unbindAllHotkeys, BOUND_ACTIONS, and unbindHotkey remain the same but no value is implicitly returned from the callback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js`:
- Around line 219-278: The subset-conflict logic in validateCombo is too strict
for Mousetrap because it treats modifier differences as conflicts; update the
loop that compares arr and otherKeys (inside validateCombo) to only treat one
combo as a conflict if their modifier sets are identical (compute modifier sets
from arr and otherKeys via existing isModifier/isOnlyModifiers helpers) before
performing the subset checks, and add a short inline comment near those checks
explaining that Mousetrap treats combos with different modifier sets as distinct
so we only block true subset conflicts with the same modifiers; if you intended
the stricter behavior instead, replace the change with a concise comment
explaining that rationale.
- Line 223: The string literal returned when sig is falsy uses a smart quote;
change it to a standard straight apostrophe to match project style and other
occurrences: update the return in the function that checks sig (the line
returning { code: ERROR.EMPTY, message: 'Shortcut can’t be empty.' }) to use a
straight apostrophe (e.g. 'Shortcut can\'t be empty.') so it matches the style
used elsewhere (see other uses of ERROR.EMPTY and escaped straight apostrophe).
In
`@packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js`:
- Around line 596-599: The useSelector hook (and derived variables
userKeyBindings, hasCustomCopyBinding, hasCustomPasteBinding) is defined after
early returns, violating Rules of Hooks; move the useSelector((state) =>
state.app.preferences) call and the lines that compute userKeyBindings,
hasCustomCopyBinding and hasCustomPasteBinding up to the top of the
CollectionItem component alongside the other hooks (near where other hooks are
declared, before any conditional returns such as the searchText filter), and
remove the original declarations at lines 596–599 so hooks are invoked in a
consistent order on every render.
- Around line 126-157: The event handlers registered in the useEffect
(handleCloneItemOpen, handleCopyItemOpen, handlePasteItemOpen) close over
mutable props/state because handleCopyItem and handlePasteItem are captured once
on mount, causing stale operations when
item/collection/collectionUid/isFolder/dispatch change; fix by either memoizing
handleCopyItem and handlePasteItem with useCallback and adding them (and any
other used values) to the useEffect dependency array, or keep the effect deps
empty but store current handler references in refs (e.g., copyHandlerRef.current
= handleCopyItem, pasteHandlerRef.current = handlePasteItem) and call those refs
inside the window event callbacks while still using isFocusedRef for focus
checks, then update the refs wherever the handlers change so the event listeners
always invoke the latest logic.
In `@packages/bruno-electron/src/app/menu-template.js`:
- Around line 66-92: The menu click handlers currently use
focusedWindow.webContents.send(...) which targets the renderer but your zoom
handlers are registered in the main process, causing an IPC direction mismatch;
change each menu click (the "Reset Zoom", "Zoom In", "Zoom Out" handlers where
BrowserWindow.getFocusedWindow() is used) to manipulate zoom directly in the
main process by getting the focusedWindow and calling its
webContents.getZoomLevel() and webContents.setZoomLevel(...) (or
setZoomFactor(...)) to implement reset/in/out behavior, rather than sending
renderer messages; ensure you remove or stop relying on webContents.send(...)
for these channels so main-process handlers (e.g., the existing ipcMain.handle
for renderer:zoom-in) are not bypassed.
- Around line 66-92: The IPC channel names used in the menu click handlers are
mismatched with the listeners; update the click handlers in the menu items (the
'Reset Zoom', 'Zoom In', and 'Zoom Out' entries in menu-template.js) to send
'main:zoom-reset', 'main:zoom-in', and 'main:zoom-out' respectively (instead of
'main:menu-zoom-*') so they match the handlers in
packages/bruno-electron/src/index.js and restore zoom functionality.
- Around line 64-65: There are two consecutive `{ type: 'separator' }` entries
in the View menu template causing an extra empty gap; remove one of the
duplicate `{ type: 'separator' }` objects in the menu template array (the View
menu block) so only a single separator remains between the adjacent menu groups.
In `@packages/bruno-electron/src/index.js`:
- Around line 195-196: The comment beside the zoomFactor option is incorrect:
zoomFactor: 1.0 only sets the initial page zoom (and is the default), it does
not disable zoom shortcuts. Either remove the misleading comment or update it to
state it sets the initial zoom; if the intent was to disable zoom shortcuts,
implement a handler on the BrowserWindow's webContents (e.g.,
BrowserWindow/webContents 'before-input-event' to intercept Ctrl/Cmd + '+', '-'
and '0' or use webFrame.setZoomLevelLimits in the preload) and remove or replace
the zoomFactor line if redundant.
- Around line 247-250: The change removed the platform guard around the ipcMain
handler for 'renderer:window-close', altering macOS behavior; either restore the
original guard using isWindows/isLinux so macOS ignores the close request, or
implement macOS-specific behavior by checking !isWindows && !isLinux and calling
mainWindow.hide() (or app.hide()) instead of mainWindow.close(); if the macOS
behavior change was intentional, delete the commented-out guard entirely to
avoid dead code.
- Around line 227-245: There are duplicate ipcMain handlers
(ipcMain.on('main:zoom-in' / 'main:zoom-out' / 'main:zoom-reset')) that mirror
the existing renderer handlers (ipcMain.on('renderer:zoom-in' /
'renderer:zoom-out' / 'renderer:reset-zoom')) and the global shortcut uses a
different step (+1); remove the duplicate 'main:zoom-*' handlers and consolidate
zoom behavior by introducing a single ZOOM_STEP constant (e.g., 0.5) used by the
remaining handlers (renderer:zoom-in, renderer:zoom-out, renderer:reset-zoom)
and by the globalShortcut.register callback that currently adjusts
mainWindow.webContents.setZoomLevel(currentZoom + 1), so update it to use
ZOOM_STEP (and -ZOOM_STEP) and always reference
mainWindow.webContents.getZoomLevel()/setZoomLevel accordingly to keep zoom
behavior consistent.
In `@packages/bruno-electron/src/store/preferences.js`:
- Around line 60-104: Add a Yup schema entry for keyBindings inside
preferencesSchema to validate the structure currently defined in the default
keyBindings object: ensure keyBindings is a Yup.object().shape(...) (or
Yup.record-style object) whose values are objects with required string fields
mac, windows, and name (use Yup.string().required()), and permit only that shape
to prevent corrupted/unknown bindings when saving preferences; update the
preferencesSchema symbol accordingly so that keyBindings is validated alongside
the other preference fields.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js`:
- Around line 1099-1106: The test currently comments out the assertion that the
environment editor opened, so it only checks the shortcut was saved but not that
it triggered the editor; restore and use the previously commented checks by
locating the tab with page.locator('.request-tab').filter({ hasText: 'Global
Environments' }) and asserting await expect(envTab).toBeVisible() after sending
the keyboard shortcut via page.keyboard.press(`${modifier}+KeyW`), and keep the
short wait (or replace waitForTimeout with a waitFor condition) to ensure the
tab has time to appear before the assertion.
- Around line 604-609: The test uses the wrong modifier when closing the
Preferences tab: replace the Cmd/Ctrl combo sent via
page.keyboard.press(`${modifier}+KeyT+KeyC`) with the actual custom binding for
closeTab (Alt+T+C) by either simulating the Alt chord with
page.keyboard.down('Alt'), page.keyboard.press('KeyT'),
page.keyboard.press('KeyC'), page.keyboard.up('Alt') or by closing the tab
through the UI using the existing locator (page.locator('.request-tab').filter({
hasText: 'Preferences' }).locator('.close-icon-container').click()); update the
code that references page.keyboard.press and the modifier variable accordingly
so the test triggers the new closeTab binding.
- Around line 764-778: The test simulates the custom "Close All Tabs" shortcut
by sending Alt+W+A (via page.keyboard.down/up) but still asserts three
'.request-tab' elements after the keypress; update the test to either (A) assert
the expected behavior like the default-binding test by changing the final
expectation on page.locator('.request-tab') to toHaveCount(1), or (B) if the
custom binding should differ, fix the key simulation to match the app's
registered shortcut (ensure the sequence and modifiers match how the app
listens) and then assert the correct resulting count; reference the keyboard
sequence code and the page.locator('.request-tab') assertion to locate the
change.
- Line 92: The test file contains stray double semicolons after statements
(e.g., the pattern "await page.waitForTimeout(200); ;") which are harmless but
untidy; remove the extra trailing semicolon occurrences so each statement ends
with a single ";" (search for ";;" or instances of "await page.waitForTimeout"
and similar lines in preference-shortcuts-edit.spec.js) and run the
linter/formatter to ensure no other duplicate-semicolon artifacts remain.
- Line 632: Remove the leftover debug statement console.log('Veried : 1') from
the test file; locate the statement in preference-shortcuts-edit.spec.js (the
console.log with the misspelled "Veried : 1") and delete that line so the test
contains no stray debug output.
- Line 3: Remove the unused Electron import to avoid runtime resolution
failures: delete the require('electron') line that imports BrowserWindow (the
unused symbol BrowserWindow) from
tests/shortcuts/preference-shortcuts-edit.spec.js and any references to
BrowserWindow in that test; if the test needs Electron functionality instead,
replace it with Playwright-compatible helpers or mocks rather than requiring
'electron'. Ensure linter passes after removal.
- Around line 5-2162: The tests overuse page.waitForTimeout and lack test.step
instrumentation, and the helper getError is defined but unused; update the key
interaction sequences (e.g., customize keybinding → verify → invoke shortcut) to
be wrapped in test.step calls, replace arbitrary await page.waitForTimeout(...)
with targeted awaits such as await expect(locator).toBeVisible(),
locator.waitFor(), or specific element state checks (use helpers
openKeybindingsTab, getEditBtn, getInput, getResetBtn as anchors to find the
flows), and either remove the unused getError helper or start using it where
keybinding error assertions are expected; ensure each replaced timeout waits for
the relevant locator/state to avoid flakiness and add concise test.step
descriptions for major actions.
---
Nitpick comments:
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js`:
- Around line 186-201: Remove the redundant runtime guard on
DEFAULT_KEY_BINDINGS inside isRowDirty: delete the `if (!DEFAULT_KEY_BINDINGS)
return false;` check (it’s a module-level constant and already dereferenced by
getDefaultRowKeysString), so isRowDirty should simply compare
getCurrentRowKeysString(action) !== getDefaultRowKeysString(action). Leave
hasDirtyRows/useMemo as-is (it already iterates
Object.keys(DEFAULT_KEY_BINDINGS)); if you want safety, perform any validation
at module init rather than inside isRowDirty.
- Around line 464-469: Remove the orphan Tooltip JSX with
id="kb-editing-error-tooltip" since it has no anchorSelect and is never
attached; delete the <Tooltip id="kb-editing-error-tooltip" ... /> element (the
standalone tooltip block) and ensure that only the per-row Tooltip instances
(the tooltips used within each row) remain; also search for any references to
"kb-editing-error-tooltip" and remove or update them if found.
In
`@packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.js`:
- Around line 48-63: The current handleSidebarSearch in useEffect relies on
setTimeout + document.querySelector('.collection-search-input') which is
fragile; replace this with a React ref/callback: create a ref (e.g.,
searchInputRef) or a focus callback in the CollectionsSection and pass it into
the Search/Input component (rather than querying by class), call
setShowSearch(true) as before, then in a useEffect/useLayoutEffect that depends
on showSearch or in the input's ref callback, call
searchInputRef.current.focus() (remove the setTimeout and DOM query). Update
references to the class selector and the handleSidebarSearch logic so focusing
is driven by the ref (preserve the event listener add/remove in useEffect).
In `@packages/bruno-app/src/providers/Hotkeys/index.js`:
- Around line 333-372: HotkeysProvider is subscribing to tabs, collections and
activeTabUid (via useSelector) purely to derive currentCollection, causing
unnecessary re-renders; remove those top-level selectors and stop computing
currentCollection on every render in HotkeysProvider, and instead compute the
collection lazily when opening the New Request modal (e.g., inside the handler
that calls setShowNewRequestModal) using the redux store directly
(store.getState()) or move the modal UI into a separate component (e.g.,
NewRequestModal) that calls useSelector for tabs/collections/activeTabUid
itself; update getCurrentCollection/currentCollection usage accordingly so
bindAllHotkeys and the provider render path no longer depend on
tabs/collections/activeTabUid.
- Around line 85-87: The forEach callback in unbindAllHotkeys implicitly returns
the value from unbindHotkey (which can return Mousetrap.unbind()), triggering
static analysis; change the implementation to explicitly ignore the return
value—e.g., replace the BOUND_ACTIONS.forEach(...) with an explicit loop (for
(const action of BOUND_ACTIONS) { unbindHotkey(action, userKeyBindings); }) or
wrap the call with void to discard the result—so unbindAllHotkeys,
BOUND_ACTIONS, and unbindHotkey remain the same but no value is implicitly
returned from the callback.
In `@packages/bruno-app/src/providers/Hotkeys/keyMappings.js`:
- Around line 128-148: getKeyBindingsForActionAllOS currently calls
getMergedKeyBindings on every invocation causing O(N^2) work when the Hotkeys
provider asks per-action; fix by computing the merged bindings once and reusing
them: either change the Hotkeys provider to call
getMergedKeyBindings(userKeyBindings) once and pass the resulting merged object
into getKeyBindingsForActionAllOS (add a new parameter like mergedBindings) or
memoize getMergedKeyBindings (e.g., cache by reference or userKeyBindings
identity) so repeated calls return the same merged object; update references to
getKeyBindingsForActionAllOS and any calls from the Hotkeys provider to use the
new parameter or rely on the memoized result.
In `@packages/bruno-electron/src/store/preferences.js`:
- Around line 60-104: Duplicate default key bindings exist between keyBindings
(in preferences.js) and DEFAULT_KEY_BINDINGS (in keyMappings.js); extract them
to a single shared module and import from both places. Create a shared export
(e.g., defaultKeyBindings) containing the same shape (platform keys mac/windows
and name) and replace the inline object in preferences.js (keyBindings) and the
app-side DEFAULT_KEY_BINDINGS to import that shared symbol; ensure
function/class references that consume these values (e.g., anywhere expecting
keyBindings or DEFAULT_KEY_BINDINGS) still receive the same object shape and
update any TypeScript types or tests to reference the new module.
| const validateCombo = (action, arrRaw) => { | ||
| const arr = uniqSorted(arrRaw); | ||
| const sig = comboSignature(arr); | ||
|
|
||
| if (!sig) return { code: ERROR.EMPTY, message: 'Shortcut can’t be empty.' }; | ||
| if (isOnlyModifiers(arr)) | ||
| return { code: ERROR.ONLY_MODIFIERS, message: 'Add a non-modifier key (e.g. Ctrl + K).' }; | ||
|
|
||
| // OS-specific must-have modifier rule | ||
| if (!hasRequiredModifier(os, arr)) { | ||
| return { | ||
| code: ERROR.MISSING_REQUIRED_MOD, | ||
| message: | ||
| os === 'mac' | ||
| ? 'macOS shortcuts must include at least one modifier (command/alt/shift/ctrl).' | ||
| : 'Windows shortcuts must include at least one modifier (ctrl/alt/shift).' | ||
| }; | ||
| } | ||
|
|
||
| // OS reserved | ||
| if (RESERVED_BY_OS[os]?.has(sig)) | ||
| return { code: ERROR.RESERVED, message: 'This shortcut is reserved by the OS.' }; | ||
|
|
||
| // No duplicates (across all other actions) | ||
| if (buildUsedSignatures(action).has(sig)) | ||
| return { code: ERROR.DUPLICATE, message: 'That shortcut is already in use.' }; | ||
|
|
||
| // Check for subset conflicts (e.g., Cmd+A conflicts with Cmd+Z+A) | ||
| for (const [otherAction, binding] of Object.entries(keyBindings)) { | ||
| if (otherAction === action) continue; | ||
| const otherKeysStr = binding?.[os]; | ||
| if (!otherKeysStr) continue; | ||
|
|
||
| const otherKeys = fromKeysString(otherKeysStr); | ||
|
|
||
| // Check if current is a subset of other (current is shorter) | ||
| if (arr.length < otherKeys.length) { | ||
| const isSubset = arr.every((k) => otherKeys.includes(k)); | ||
| if (isSubset) { | ||
| return { | ||
| code: ERROR.CONFLICT, | ||
| message: `Conflicts with "${binding.name}" (${otherKeys.join(' + ')}). Remove the longer shortcut first.` | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| // Check if other is a subset of current (current is longer) | ||
| if (arr.length > otherKeys.length) { | ||
| const isSubset = otherKeys.every((k) => arr.includes(k)); | ||
| if (isSubset) { | ||
| return { | ||
| code: ERROR.CONFLICT, | ||
| message: `Conflicts with "${binding.name}" (${otherKeys.join(' + ')}). Remove that shortcut first.` | ||
| }; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| }; |
There was a problem hiding this comment.
Subset-conflict validation may be overly restrictive for Mousetrap.
The conflict check (lines 254–274) flags Ctrl+K as conflicting with Ctrl+Shift+K because one is a "subset" of the other. Mousetrap treats these as distinct combos — modifiers are part of the match, so ctrl+k will not fire when ctrl+shift+k is pressed. This could prevent users from assigning perfectly valid non-overlapping shortcuts.
Consider whether this restriction is intentional. If it is, a brief inline comment explaining the rationale would help future maintainers.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` around
lines 219 - 278, The subset-conflict logic in validateCombo is too strict for
Mousetrap because it treats modifier differences as conflicts; update the loop
that compares arr and otherKeys (inside validateCombo) to only treat one combo
as a conflict if their modifier sets are identical (compute modifier sets from
arr and otherKeys via existing isModifier/isOnlyModifiers helpers) before
performing the subset checks, and add a short inline comment near those checks
explaining that Mousetrap treats combos with different modifier sets as distinct
so we only block true subset conflicts with the same modifiers; if you intended
the stricter behavior instead, replace the change with a concise comment
explaining that rationale.
| // Close preferences using the OLD shortcut (we just customized closeTab) | ||
| // await page.locator('.request-tab').filter({ hasText: 'Preferences' }).locator('.close-icon-container').click(); | ||
| // await page.waitForTimeout(1000); | ||
|
|
||
| await page.keyboard.press(`${modifier}+KeyT+KeyC`); | ||
| await page.waitForTimeout(500); |
There was a problem hiding this comment.
Wrong modifier used to close the preferences tab after customizing closeTab.
Line 608 uses ${modifier}+KeyT+KeyC (i.e., Cmd/Ctrl+T+C), but closeTab was just re-bound to Alt+T+C. The old default Cmd/Ctrl+W was unbound. This line should either use the new custom combo (Alt+T+C via keyboard.down/up) or close the tab via the UI (click the close icon).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js` around lines 604 - 609,
The test uses the wrong modifier when closing the Preferences tab: replace the
Cmd/Ctrl combo sent via page.keyboard.press(`${modifier}+KeyT+KeyC`) with the
actual custom binding for closeTab (Alt+T+C) by either simulating the Alt chord
with page.keyboard.down('Alt'), page.keyboard.press('KeyT'),
page.keyboard.press('KeyC'), page.keyboard.up('Alt') or by closing the tab
through the UI using the existing locator (page.locator('.request-tab').filter({
hasText: 'Preferences' }).locator('.close-icon-container').click()); update the
code that references page.keyboard.press and the modifier variable accordingly
so the test triggers the new closeTab binding.
| await expect(page.locator('.request-tab')).toHaveCount(3); // 'request-1/2/3' | ||
|
|
||
| // Press Alt+W+A to close all tabs | ||
| await page.keyboard.down('Alt'); | ||
| await page.keyboard.down('KeyW'); | ||
| await page.keyboard.down('KeyA'); | ||
| await page.waitForTimeout(200); | ||
| await page.keyboard.up('KeyA'); | ||
| await page.keyboard.up('KeyW'); | ||
| await page.keyboard.up('Alt'); | ||
| await page.waitForTimeout(200); | ||
|
|
||
| // Verify all tabs are closed | ||
| await expect(page.locator('.request-tab')).toHaveCount(3); // Overview / Global Environments / Preferences | ||
| }); |
There was a problem hiding this comment.
Suspicious assertion: customized "Close All Tabs" appears to not actually close anything.
Line 764 asserts 3 request tabs before pressing the customized Alt+W+A. Line 777 still expects 3 tabs afterwards (with comment "Overview / Global Environments / Preferences"). Compare with the default-binding test (line 699) which expects count to drop to 1. Either the customized binding isn't working as expected, or the assertion is wrong.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js` around lines 764 - 778,
The test simulates the custom "Close All Tabs" shortcut by sending Alt+W+A (via
page.keyboard.down/up) but still asserts three '.request-tab' elements after the
keypress; update the test to either (A) assert the expected behavior like the
default-binding test by changing the final expectation on
page.locator('.request-tab') to toHaveCount(1), or (B) if the custom binding
should differ, fix the key simulation to match the app's registered shortcut
(ensure the sequence and modifiers match how the app listens) and then assert
the correct resulting count; reference the keyboard sequence code and the
page.locator('.request-tab') assertion to locate the change.
| // Verify environment editor tab is visible | ||
| // const envTab = page.locator('.request-tab').filter({ hasText: 'Global Environments' }); | ||
| // await expect(envTab).toBeVisible(); | ||
|
|
||
| // Close the environment tab | ||
| await page.keyboard.press(`${modifier}+KeyW`); | ||
| await page.waitForTimeout(300); | ||
| }); |
There was a problem hiding this comment.
Commented-out assertions — test doesn't verify the environment editor actually opened.
Lines 1099–1101 comment out the assertion that the environment tab is visible after pressing the customized shortcut. Without this check, the test only verifies the keybinding was saved, not that it actually works.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js` around lines 1099 - 1106,
The test currently comments out the assertion that the environment editor
opened, so it only checks the shortcut was saved but not that it triggered the
editor; restore and use the previously commented checks by locating the tab with
page.locator('.request-tab').filter({ hasText: 'Global Environments' }) and
asserting await expect(envTab).toBeVisible() after sending the keyboard shortcut
via page.keyboard.press(`${modifier}+KeyW`), and keep the short wait (or replace
waitForTimeout with a waitFor condition) to ensure the tab has time to appear
before the assertion.
There was a problem hiding this comment.
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/StatusBar/index.js (1)
5-6: 🛠️ Refactor suggestion | 🟠 MajorDead imports:
MousetrapandgetKeyBindingsForActionAllOSare no longer used.These two imports were only consumed by the old
openGlobalSearchimplementation. Now that it dispatches aCustomEvent, they're unused and should be removed.🧹 Proposed cleanup
-import Mousetrap from 'mousetrap'; -import { getKeyBindingsForActionAllOS } from 'providers/Hotkeys/keyMappings';🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/StatusBar/index.js` around lines 5 - 6, Remove the dead imports Mousetrap and getKeyBindingsForActionAllOS from the module since they are no longer referenced after replacing the old openGlobalSearch implementation; locate the import lines importing Mousetrap and getKeyBindingsForActionAllOS in packages/bruno-app/src/components/StatusBar/index.js and delete those import entries (leaving any other imports intact) and run a quick lint/compile to ensure no residual references to Mousetrap or getKeyBindingsForActionAllOS remain (also verify openGlobalSearch now dispatches a CustomEvent and does not rely on them).packages/bruno-electron/src/index.js (1)
462-467:⚠️ Potential issue | 🟠 MajorZoom step of
+1here is inconsistent with±0.5everywhere else.The global shortcut at Line 466 increments zoom by
1, while all IPC handlers (Lines 228–278) use0.5. This creates a jarring UX whereCtrl+=zooms twice as aggressively as the menu/shortcut-driven zoom. Unify with a constant.Proposed fix
+const ZOOM_STEP = 0.5; + // Register the global shortcuts app.on('browser-window-focus', () => { // Quick fix for Electron issue `#29996`: https://github.com/electron/electron/issues/29996 globalShortcut.register('Ctrl+=', () => { - mainWindow.webContents.setZoomLevel(mainWindow.webContents.getZoomLevel() + 1); + mainWindow.webContents.setZoomLevel(mainWindow.webContents.getZoomLevel() + ZOOM_STEP); }); });Then reuse
ZOOM_STEPin the IPC handlers as well.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-electron/src/index.js` around lines 462 - 467, The global shortcut increments zoom by 1 which conflicts with the 0.5 step used elsewhere; introduce a single ZOOM_STEP constant (set to 0.5) and use it in the globalShortcut.register callback (replace the hardcoded +1 with ZOOM_STEP applied to mainWindow.webContents.getZoomLevel()/setZoomLevel) and update the IPC zoom handlers (the handlers that increment/decrement zoom) to also use ZOOM_STEP so all zoom changes are consistent across globalShortcut.register, mainWindow.webContents.setZoomLevel/getZoomLevel and the IPC zoom handlers.
🧹 Nitpick comments (1)
packages/bruno-electron/src/index.js (1)
228-233: Missingnullguard onmainWindowis inconsistent across handlers.The new
main:zoom-*handlers guard withif (mainWindow && mainWindow.webContents), but the existingrenderer:zoom-in/outhandlers at Lines 270–278 and the global shortcut at Line 466 accessmainWindow.webContentsdirectly without a guard. Either all handlers should guard or none should — pick one convention. SincemainWindowis module-scoped and these handlers only fire after the window is created, the guards here are likely unnecessary noise.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-electron/src/index.js` around lines 228 - 233, The new handlers ipcMain.on('main:zoom-in') and ipcMain.on('main:zoom-out') add redundant null checks for mainWindow and mainWindow.webContents that are inconsistent with the existing renderer:zoom-in/renderer:zoom-out handlers and the global shortcut usage; remove the if (mainWindow && mainWindow.webContents) guard in those handlers and directly call mainWindow.webContents.getZoomLevel()/setZoomLevel(...) so behavior and convention match the other zoom handlers and the global shortcut that already assume mainWindow exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/bruno-app/src/components/StatusBar/index.js`:
- Around line 5-6: Remove the dead imports Mousetrap and
getKeyBindingsForActionAllOS from the module since they are no longer referenced
after replacing the old openGlobalSearch implementation; locate the import lines
importing Mousetrap and getKeyBindingsForActionAllOS in
packages/bruno-app/src/components/StatusBar/index.js and delete those import
entries (leaving any other imports intact) and run a quick lint/compile to
ensure no residual references to Mousetrap or getKeyBindingsForActionAllOS
remain (also verify openGlobalSearch now dispatches a CustomEvent and does not
rely on them).
In `@packages/bruno-electron/src/index.js`:
- Around line 462-467: The global shortcut increments zoom by 1 which conflicts
with the 0.5 step used elsewhere; introduce a single ZOOM_STEP constant (set to
0.5) and use it in the globalShortcut.register callback (replace the hardcoded
+1 with ZOOM_STEP applied to mainWindow.webContents.getZoomLevel()/setZoomLevel)
and update the IPC zoom handlers (the handlers that increment/decrement zoom) to
also use ZOOM_STEP so all zoom changes are consistent across
globalShortcut.register, mainWindow.webContents.setZoomLevel/getZoomLevel and
the IPC zoom handlers.
---
Duplicate comments:
In `@packages/bruno-electron/src/index.js`:
- Around line 248-251: The commented-out platform guard in the ipcMain listener
for 'renderer:window-close' is dead code; either remove the comment line
entirely or restore the platform-specific behavior by reintroducing the guard
that checks isWindows/isLinux inside the ipcMain.on('renderer:window-close',
...) handler and conditionally call mainWindow.hide() on macOS (i.e., when not
isWindows and not isLinux) and mainWindow.close() otherwise; update the ipcMain
handler around the 'renderer:window-close' listener accordingly and ensure
isWindows/isLinux symbols are referenced or removed consistently.
- Around line 196-197: Reviewer flagged webviewTag: true in the BrowserWindow
webPreferences as a potential security risk and the zoomFactor comment as
misleading; verify whether the app actually uses <webview> and if not remove
webviewTag from webPreferences, otherwise document and constrain its usage
(ensure loaded content is trusted, enable appropriate webview sandboxing
options), and update the zoomFactor comment to accurately state its purpose;
search for occurrences using the webviewTag symbol and <webview> usage in
renderers and then either remove the setting and switch to BrowserView/iframe
with webContents or keep it with added security controls and clearer comment
next to the zoomFactor and webPreferences configuration.
- Around line 227-246: The three ipcMain.on handlers for "main:zoom-in",
"main:zoom-out", and "main:zoom-reset" duplicate the existing
"renderer:zoom-in", "renderer:zoom-out", and "renderer:reset-zoom" logic and
also use a different signaling pattern; remove the duplicate ipcMain.on blocks
and consolidate by wiring the "main:*" channels to the same implementations used
by the renderer handlers (or replace the "main:*" registrations with
ipcMain.handle calls that call the same zoom logic). Specifically, locate the
existing renderer handlers (ipcMain.handle('renderer:zoom-in' /
'renderer:zoom-out' / 'renderer:reset-zoom')) and either: 1) register equivalent
ipcMain.handle('main:zoom-in' / 'main:zoom-out' / 'main:zoom-reset') that invoke
the same code path that uses mainWindow.webContents.getZoomLevel()/setZoomLevel,
or 2) remove the duplicated main: handlers and map incoming main:* messages to
call the renderer:* handlers internally; ensure you use ipcMain.handle
consistently and reference mainWindow.webContents within the shared handler.
---
Nitpick comments:
In `@packages/bruno-electron/src/index.js`:
- Around line 228-233: The new handlers ipcMain.on('main:zoom-in') and
ipcMain.on('main:zoom-out') add redundant null checks for mainWindow and
mainWindow.webContents that are inconsistent with the existing
renderer:zoom-in/renderer:zoom-out handlers and the global shortcut usage;
remove the if (mainWindow && mainWindow.webContents) guard in those handlers and
directly call mainWindow.webContents.getZoomLevel()/setZoomLevel(...) so
behavior and convention match the other zoom handlers and the global shortcut
that already assume mainWindow exists.
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js (1)
580-601:⚠️ Potential issue | 🔴 CriticalRules of Hooks violation —
useCallbackcalled after early returns.Lines 478–488 contain conditional
return nullstatements, butuseCallbackat Lines 580 and 586 runs after them. React requires hooks to execute in the same order on every render. WhensearchTextfilters out this item, these hooks are skipped, which will cause runtime errors.Move both
useCallbackdeclarations (and the ref assignments at Lines 603–605) above the early returns — near the other hooks at the top of the component.🐛 Proposed fix — move hooks above the early return block
+ const handleCopyItem = useCallback(() => { + dispatch(copyRequest(item)); + const itemType = isFolder ? 'Folder' : 'Request'; + toast.success(`${itemType} copied`); + }, [dispatch, item, isFolder]); + + const handlePasteItem = useCallback(() => { + let targetFolderUid = item.uid; + if (!isFolder) { + const parentFolder = findParentItemInCollection(collection, item.uid); + targetFolderUid = parentFolder ? parentFolder.uid : null; + } + dispatch(pasteItem(collectionUid, targetFolderUid)) + .then(() => { + toast.success('Item pasted successfully'); + }) + .catch((err) => { + toast.error(err ? err.message : 'An error occurred while pasting the item'); + }); + }, [dispatch, collection, item, isFolder, collectionUid]); + + // Update refs whenever handlers change + copyHandlerRef.current = handleCopyItem; + pasteHandlerRef.current = handlePasteItem; + const className = classnames('flex flex-col w-full', { 'is-sidebar-dragging': isSidebarDragging }); if (searchText && searchText.length) { // ... early returns ... } // ... other non-hook code ... - const handleCopyItem = useCallback(() => { - dispatch(copyRequest(item)); - const itemType = isFolder ? 'Folder' : 'Request'; - toast.success(`${itemType} copied`); - }, [dispatch, item, isFolder]); - - const handlePasteItem = useCallback(() => { - let targetFolderUid = item.uid; - if (!isFolder) { - const parentFolder = findParentItemInCollection(collection, item.uid); - targetFolderUid = parentFolder ? parentFolder.uid : null; - } - dispatch(pasteItem(collectionUid, targetFolderUid)) - .then(() => { - toast.success('Item pasted successfully'); - }) - .catch((err) => { - toast.error(err ? err.message : 'An error occurred while pasting the item'); - }); - }, [dispatch, collection, item, isFolder, collectionUid]); - - // Update refs whenever handlers change - copyHandlerRef.current = handleCopyItem; - pasteHandlerRef.current = handlePasteItem;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js` around lines 580 - 601, The useCallback hooks handleCopyItem and handlePasteItem (which dispatch copyRequest and pasteItem and reference findParentItemInCollection, dispatch, collection, item, isFolder, collectionUid) and the related ref assignments must be moved above any conditional early returns so hooks run unconditionally and in consistent order; relocate those useCallback declarations and the ref initializations to the top of the component near the other hooks (keeping their current dependency arrays) and then keep the existing logic for early returns below them.
🧹 Nitpick comments (3)
packages/bruno-app/src/components/Preferences/Keybindings/index.js (1)
464-469: Unused top-levelTooltipcomponent.This
Tooltipwithid="kb-editing-error-tooltip"is rendered at lines 464-469 but has noanchorSelectand is never referenced. The per-row tooltips (lines 536-544) each use their ownid. Remove this dead element.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` around lines 464 - 469, Remove the unused top-level Tooltip element with id="kb-editing-error-tooltip" since it has no anchorSelect and is never referenced; locate the JSX Tooltip component instance (Tooltip id="kb-editing-error-tooltip") inside the Keybindings component and delete that element so only the per-row tooltips (the ones around lines where individual rows create their own Tooltip ids) remain.packages/bruno-app/src/providers/Hotkeys/index.js (2)
338-356: Redundant double-unbind on keybinding changes.The
prevKeyBindingsRefunbind (lines 341-346) duplicates the work done by the effect's cleanup function (lines 352-355). WhenuserKeyBindingschanges from A → B:
- Cleanup fires →
unbindAllHotkeys(A)✓- New effect →
unbindAllHotkeys(A)again via ref (no-op but wasteful)The ref is unnecessary since the effect already depends on
[userKeyBindings]and the cleanup captures the correct closure. Consider removing the ref-based unbind and keeping only the cleanup return.Simplified version
- const prevKeyBindingsRef = useRef(undefined); ... useEffect(() => { - const prevBindings = prevKeyBindingsRef.current; - if (prevBindings !== undefined) { - unbindAllHotkeys(prevBindings); - } bindAllHotkeys(userKeyBindings); - prevKeyBindingsRef.current = userKeyBindings; return () => { unbindAllHotkeys(userKeyBindings); }; }, [userKeyBindings]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/providers/Hotkeys/index.js` around lines 338 - 356, The effect currently double-unbinds by using prevKeyBindingsRef plus the cleanup; remove the prevKeyBindingsRef logic and its conditional call to unbindAllHotkeys so the effect only calls bindAllHotkeys(userKeyBindings) and its cleanup returns unbindAllHotkeys(userKeyBindings). Specifically, delete references to prevKeyBindingsRef and the block that reads/unbinds prevBindings, keep bindAllHotkeys(userKeyBindings) and the return cleanup that calls unbindAllHotkeys(userKeyBindings) inside the useEffect that depends on userKeyBindings.
84-86: Static analysis: forEach callback implicitly returns a value.Biome flags the implicit return from the arrow in
BOUND_ACTIONS.forEach(...). Wrap the body in braces to make the void intent explicit.Suggested fix
function unbindAllHotkeys(userKeyBindings) { - BOUND_ACTIONS.forEach((action) => unbindHotkey(action, userKeyBindings)); + BOUND_ACTIONS.forEach((action) => { unbindHotkey(action, userKeyBindings); }); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/providers/Hotkeys/index.js` around lines 84 - 86, The forEach callback in unbindAllHotkeys currently uses a concise arrow that implicitly returns a value; change the callback to a block-bodied arrow to make the void intent explicit: update BOUND_ACTIONS.forEach((action) => unbindHotkey(action, userKeyBindings)) to use braces and an explicit statement body so it reads like BOUND_ACTIONS.forEach((action) => { unbindHotkey(action, userKeyBindings); }); this keeps behavior the same while satisfying the static analyzer that the callback returns void (refer to the unbindAllHotkeys function, BOUND_ACTIONS.forEach call, and unbindHotkey).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js`:
- Around line 280-294: persistToPreferences is setting the key-binding "name" to
the camelCase action when no existing preference exists, which overwrites the
human-readable name from DEFAULT_KEY_BINDINGS on first edit; change the fallback
so the name is taken from DEFAULT_KEY_BINDINGS for that action if present (e.g.,
use preferences?.keyBindings?.[action]?.name ||
DEFAULT_KEY_BINDINGS?.[action]?.name || action) before dispatching
savePreferences, so the merge with the default key bindings preserves the
human-readable label; update the logic in persistToPreferences and ensure
DEFAULT_KEY_BINDINGS is imported/available where used.
- Line 501: The current showPencil boolean (const showPencil = isHovered &&
!isEditing && !isDirty) hides the pencil once a row is dirty; update the
condition so the pencil is shown when hovered and not editing even if isDirty
(e.g., const showPencil = isHovered && !isEditing) or alternatively render both
the pencil and the reset/refresh icon when isDirty so users can re-open edit
mode without resetting; change the logic around showPencil and the rendering
that checks isDirty to allow the pencil icon to render for dirty rows.
- Around line 186-201: Remove the dead guard checking DEFAULT_KEY_BINDINGS and
eliminate the stale closure by defining isRowDirty inside the hasDirtyRows
useMemo (so it closes over current keyBindings/os), then iterate
Object.keys(DEFAULT_KEY_BINDINGS) inside that same useMemo and return true if
any getCurrentRowKeysString(action) !== getDefaultRowKeysString(action); keep
useMemo deps [keyBindings, os] (no external closure over isRowDirty) and
reference the symbols isRowDirty, getCurrentRowKeysString,
getDefaultRowKeysString, DEFAULT_KEY_BINDINGS, and hasDirtyRows when making the
change.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js`:
- Around line 696-759: The test sets a custom keybinding for closeAllTabs to
Alt+W+A but never triggers it; after opening and pinning the three request tabs,
simulate the custom shortcut (e.g., emulate the recorded multi-key sequence by
sending Alt down, KeyW down/up, KeyA down/up, then Alt up using page.keyboard
like in the earlier recording block) and then assert the tab count has dropped
(use the same locator '.request-tab' and expect count === 1) to verify the
custom binding invoked closeAllTabs; references: openKeybindingsTab,
getEditBtn('closeAllTabs'), getInput('closeAllTabs'), and the existing
page.keyboard down/up sequence used earlier in the test.
- Around line 1686-1689: The assertion using requestCount >= 1 is too weak;
update the test that uses allRequests/page.locator('.collection-item-name') to
assert requestCount >= 2 to ensure the paste created a second item, and also add
an explicit visibility check for the original request (same check used in the
default test at line ~1580) to confirm both original and pasted items are
present; apply the same change to the folder copy/paste test around the other
failing assertion (near line 1816) so both tests validate paste success.
- Around line 1079-1150: The zoom tests (tests named "FUNCTIONAL: Zoom In" and
the customized variant using getEditBtn/openKeybindingsTab/getInput) currently
only send key events with no verification; update each zoom-in, zoom-out and
reset-zoom test to capture a measurable zoom indicator before and after the
shortcut (e.g., via page.evaluate(() => window.devicePixelRatio) or computing an
element's computedStyle width/height), then assert the value changed in the
expected direction for zoom-in/zoom-out and returned to the base value for
reset-zoom; use the existing test scaffolding (the test blocks, modifier
variable, and helper functions like getEditBtn and getInput) to place the checks
immediately after the key presses and include clear expect assertions comparing
before/after values.
- Around line 1710-1714: There is a duplicate call to openKeybindingsTab()
before interacting with keybinding rows; remove the redundant invocation so the
test only calls openKeybindingsTab() once (the existing call that opens
Preferences and clicks the Keybindings tab) and then proceeds to hover on
resetCopyRow and call getResetBtn(page, 'copyItem').click(); ensure references
to openKeybindingsTab, resetCopyRow, and getResetBtn remain intact.
- Around line 1019-1076: The test sets a custom combo for editEnvironment but
never invokes it — instead it closes tabs and asserts the environment tab is not
visible; change the end of the test to actually trigger the saved shortcut
sequence and assert the environment editor opens: after saving the keybinding
(using getEditBtn and getInput) and closing preferences, simulate the multi-key
sequence (Alt down → KeyE → KeyG → release keys) the same way you recorded it,
then await and expect the envTab locator ('.request-tab' filtered by
'Environments') to be visible; remove or replace the erroneous close-tab +
expect(...).not.toBeVisible() assertions so the test verifies the environment
tab is shown after pressing the custom shortcut.
---
Outside diff comments:
In
`@packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js`:
- Around line 580-601: The useCallback hooks handleCopyItem and handlePasteItem
(which dispatch copyRequest and pasteItem and reference
findParentItemInCollection, dispatch, collection, item, isFolder, collectionUid)
and the related ref assignments must be moved above any conditional early
returns so hooks run unconditionally and in consistent order; relocate those
useCallback declarations and the ref initializations to the top of the component
near the other hooks (keeping their current dependency arrays) and then keep the
existing logic for early returns below them.
---
Duplicate comments:
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js`:
- Line 223: Replace the smart curly apostrophe in the template literal that
returns `{ code: ERROR.EMPTY, message: \`Shortcut can’t be empty.\` }` with a
straight apostrophe to match the rest of the file (use `Shortcut can't be
empty.`), ensuring the string style is consistent with the other occurrence that
uses `\'`; update the message exactly where that return is generated so it
matches the escaped straight-quote convention used elsewhere.
- Around line 246-275: The subset-conflict check in the loop that iterates
keyBindings (using arr, otherKeys, fromKeysString, ERROR.CONFLICT, binding.name)
is falsely flagging combos like Ctrl+K vs Ctrl+Shift+K; update the logic in the
same function (the block doing "Check for subset conflicts") to treat modifier
keys separately: parse modifiers and the main key(s) from arr and otherKeys
(using fromKeysString), and only consider a subset conflict when the modifier
sets are identical (or when both have no modifiers) and the non-modifier key
sequence is a strict subset; otherwise allow different modifier sets (e.g., Ctrl
vs Ctrl+Shift) as non-conflicting and do not return ERROR.CONFLICT.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js`:
- Line 22: The helper function getError (const getError = (page, action) =>
page.getByTestId(`keybinding-error-${action}`)) is defined but never used;
either delete this unused helper to clean up the test file or replace direct
error selectors in relevant tests with getError(page, '...') to assert
validation messages (e.g., in the keybinding validation/error test cases).
Locate the getError declaration and either remove it or update tests that check
error elements to call getError for clarity and reuse.
- Around line 4-11: The test file overuses waitForTimeout and lacks test.step
blocks; update the suite by replacing arbitrary waits with targeted locator
waits (e.g., replace calls like page.waitForTimeout(...) with await
page.locator('<selector>').waitFor() or await
expect(page.locator('<selector>')).toBeVisible()) and add test.step wrappers
around logical interaction sequences (wrap setup/navigation/assertion groups
inside test.step in the describe block and inside test.beforeEach where setup
occurs); search for symbols like modifier, modifierName, and test.beforeEach to
locate initialization and all test cases in this file and refactor each
occurrence of waitForTimeout to a locator-based wait and group related actions
into test.step blocks for clearer reporting and more reliable timing.
- Around line 603-604: The test uses the wrong keyboard chord to close
Preferences: update the press call that currently uses `${modifier}+KeyT+KeyC`
to either simulate the new binding `Alt+KeyT+KeyC` (replace `${modifier}` with
`Alt`) so it sends the Alt+T+C chord, or replace the keyboard press with a click
on the Preferences close UI button (use the existing selector for the close
button in the preferences modal) to ensure the tab actually closes before
continuing; change the line containing the press call and any nearby wait to
reflect the chosen approach.
---
Nitpick comments:
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js`:
- Around line 464-469: Remove the unused top-level Tooltip element with
id="kb-editing-error-tooltip" since it has no anchorSelect and is never
referenced; locate the JSX Tooltip component instance (Tooltip
id="kb-editing-error-tooltip") inside the Keybindings component and delete that
element so only the per-row tooltips (the ones around lines where individual
rows create their own Tooltip ids) remain.
In `@packages/bruno-app/src/providers/Hotkeys/index.js`:
- Around line 338-356: The effect currently double-unbinds by using
prevKeyBindingsRef plus the cleanup; remove the prevKeyBindingsRef logic and its
conditional call to unbindAllHotkeys so the effect only calls
bindAllHotkeys(userKeyBindings) and its cleanup returns
unbindAllHotkeys(userKeyBindings). Specifically, delete references to
prevKeyBindingsRef and the block that reads/unbinds prevBindings, keep
bindAllHotkeys(userKeyBindings) and the return cleanup that calls
unbindAllHotkeys(userKeyBindings) inside the useEffect that depends on
userKeyBindings.
- Around line 84-86: The forEach callback in unbindAllHotkeys currently uses a
concise arrow that implicitly returns a value; change the callback to a
block-bodied arrow to make the void intent explicit: update
BOUND_ACTIONS.forEach((action) => unbindHotkey(action, userKeyBindings)) to use
braces and an explicit statement body so it reads like
BOUND_ACTIONS.forEach((action) => { unbindHotkey(action, userKeyBindings); });
this keeps behavior the same while satisfying the static analyzer that the
callback returns void (refer to the unbindAllHotkeys function,
BOUND_ACTIONS.forEach call, and unbindHotkey).
| const isRowDirty = (action) => { | ||
| const current = getCurrentRowKeysString(action); | ||
| const def = getDefaultRowKeysString(action); | ||
| if (!DEFAULT_KEY_BINDINGS) return false; | ||
| return current !== def; | ||
| }; | ||
|
|
||
| // Check if any keybinding is dirty (different from default) | ||
| const hasDirtyRows = useMemo(() => { | ||
| for (const action of Object.keys(DEFAULT_KEY_BINDINGS)) { | ||
| if (isRowDirty(action)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| }, [keyBindings, os]); |
There was a problem hiding this comment.
hasDirtyRows has a stale closure and a dead guard.
Two issues:
- Line 189:
if (!DEFAULT_KEY_BINDINGS) return false;—DEFAULT_KEY_BINDINGSis a module-level constant object, so this guard is always falsy and dead code. isRowDirtyis defined outsideuseMemoand closes overkeyBindings(viagetCurrentRowKeysString), butisRowDirtyitself isn't listed as a dependency. The lint rule for exhaustive deps would flag this. SincekeyBindingsis in the dep array it works in practice, but calling a function that implicitly captures state insideuseMemowithout listing it is fragile.
Suggested fix
const isRowDirty = (action) => {
const current = getCurrentRowKeysString(action);
const def = getDefaultRowKeysString(action);
- if (!DEFAULT_KEY_BINDINGS) return false;
return current !== def;
};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` around
lines 186 - 201, Remove the dead guard checking DEFAULT_KEY_BINDINGS and
eliminate the stale closure by defining isRowDirty inside the hasDirtyRows
useMemo (so it closes over current keyBindings/os), then iterate
Object.keys(DEFAULT_KEY_BINDINGS) inside that same useMemo and return true if
any getCurrentRowKeysString(action) !== getDefaultRowKeysString(action); keep
useMemo deps [keyBindings, os] (no external closure over isRowDirty) and
reference the symbols isRowDirty, getCurrentRowKeysString,
getDefaultRowKeysString, DEFAULT_KEY_BINDINGS, and hasDirtyRows when making the
change.
| const persistToPreferences = (action, nextKeys) => { | ||
| const updatedPreferences = { | ||
| ...preferences, | ||
| keyBindings: { | ||
| ...(preferences?.keyBindings || {}), | ||
| [action]: { | ||
| ...(preferences?.keyBindings?.[action] || {}), | ||
| name: preferences?.keyBindings?.[action]?.name || action, | ||
| [os]: nextKeys | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| dispatch(savePreferences(updatedPreferences)); | ||
| }; |
There was a problem hiding this comment.
persistToPreferences stores wrong name on first edit.
Line 287 falls back to action (e.g., 'globalSearch') as the name when preferences?.keyBindings?.[action]?.name is undefined (i.e., the first time a user edits that binding). This camelCase key then overwrites the human-readable name from DEFAULT_KEY_BINDINGS during the merge at lines 148-155, causing the table and conflict error messages to display "globalSearch" instead of "Global Search".
Suggested fix
const persistToPreferences = (action, nextKeys) => {
const updatedPreferences = {
...preferences,
keyBindings: {
...(preferences?.keyBindings || {}),
[action]: {
...(preferences?.keyBindings?.[action] || {}),
- name: preferences?.keyBindings?.[action]?.name || action,
+ name: preferences?.keyBindings?.[action]?.name || DEFAULT_KEY_BINDINGS[action]?.name || action,
[os]: nextKeys
}
}
};
dispatch(savePreferences(updatedPreferences));
};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` around
lines 280 - 294, persistToPreferences is setting the key-binding "name" to the
camelCase action when no existing preference exists, which overwrites the
human-readable name from DEFAULT_KEY_BINDINGS on first edit; change the fallback
so the name is taken from DEFAULT_KEY_BINDINGS for that action if present (e.g.,
use preferences?.keyBindings?.[action]?.name ||
DEFAULT_KEY_BINDINGS?.[action]?.name || action) before dispatching
savePreferences, so the merge with the default key bindings preserves the
human-readable label; update the logic in persistToPreferences and ensure
DEFAULT_KEY_BINDINGS is imported/available where used.
| const isHovered = hoveredAction === action; | ||
| const isDirty = isRowDirty(action); | ||
|
|
||
| const showPencil = isHovered && !isEditing && !isDirty; |
There was a problem hiding this comment.
Users can't re-edit an already-customized keybinding without resetting first.
showPencil is isHovered && !isEditing && !isDirty, meaning once a row is dirty (customized), the pencil icon disappears and only the reset button shows. To change a customized binding again, the user must reset to default first, then re-edit.
Consider showing both the pencil and refresh icons when the row is dirty, so users can directly re-edit.
Suggested fix
-const showPencil = isHovered && !isEditing && !isDirty;
-const showRefresh = isDirty && !isEditing;
+const showPencil = isHovered && !isEditing;
+const showRefresh = isDirty && !isEditing;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/bruno-app/src/components/Preferences/Keybindings/index.js` at line
501, The current showPencil boolean (const showPencil = isHovered && !isEditing
&& !isDirty) hides the pencil once a row is dirty; update the condition so the
pencil is shown when hovered and not editing even if isDirty (e.g., const
showPencil = isHovered && !isEditing) or alternatively render both the pencil
and the reset/refresh icon when isDirty so users can re-open edit mode without
resetting; change the logic around showPencil and the rendering that checks
isDirty to allow the pencil icon to render for dirty rows.
| test('should close all tabs using customized-1 Alt+W+A', async ({ page, createTmpDir }) => { | ||
| // Close all collections, tabs, and preferences first | ||
| await closeAllCollections(page); | ||
|
|
||
| // Close any open preference tabs | ||
| const preferenceTabs = page.locator('.request-tab').filter({ hasText: 'Preferences' }); | ||
| const prefTabCount = await preferenceTabs.count(); | ||
| for (let i = 0; i < prefTabCount; i++) { | ||
| await page.keyboard.press(`${modifier}+KeyW`); | ||
| await page.waitForTimeout(200); | ||
| } | ||
|
|
||
| // Open Keybindings preferences and customize closeAllTabs FIRST | ||
| await openKeybindingsTab(page); | ||
|
|
||
| const row = page.getByTestId('keybinding-row-closeAllTabs'); | ||
| await row.hover(); | ||
|
|
||
| // Start recording | ||
| await getEditBtn(page, 'closeAllTabs').click(); | ||
| await page.waitForTimeout(300); | ||
|
|
||
| // Press new combo: Alt+W+A (multi-key sequence) | ||
| // Use down/up to ensure proper key recording | ||
| await page.keyboard.down('Alt'); | ||
| await page.keyboard.down('KeyW'); | ||
| await page.keyboard.down('KeyA'); | ||
| await page.waitForTimeout(200); | ||
| await page.keyboard.up('KeyA'); | ||
| await page.keyboard.up('KeyW'); | ||
| await page.keyboard.up('Alt'); | ||
| await page.waitForTimeout(500); | ||
|
|
||
| // Verify the keybinding was saved | ||
| const input = getInput(page, 'closeAllTabs'); | ||
| const newValue = await input.inputValue(); | ||
| expect(newValue).toContain('alt'); | ||
| expect(newValue).toContain('w'); | ||
| expect(newValue).toContain('a'); | ||
|
|
||
| // Close preferences | ||
| await page.keyboard.press(`${modifier}+KeyW`); | ||
| await page.waitForTimeout(500); | ||
|
|
||
| // Now create collection and requests | ||
| const collectionPath = await createTmpDir('close-all-tabs-customized-1'); | ||
| await createCollection(page, 'test-collection-close-all-customized-1', collectionPath); | ||
|
|
||
| // Create multiple requests | ||
| await createRequest(page, 'request-1', 'test-collection-close-all-customized-1'); | ||
| await createRequest(page, 'request-2', 'test-collection-close-all-customized-1'); | ||
| await createRequest(page, 'request-3', 'test-collection-close-all-customized-1'); | ||
|
|
||
| // Open and pin all requests | ||
| await openRequest(page, 'test-collection-close-all-customized-1', 'request-1', { persist: true }); | ||
| await openRequest(page, 'test-collection-close-all-customized-1', 'request-2', { persist: true }); | ||
| await openRequest(page, 'test-collection-close-all-customized-1', 'request-3', { persist: true }); | ||
|
|
||
| // Wait for tabs to be ready | ||
| await page.waitForTimeout(500); | ||
|
|
||
| // Verify all tabs are closed | ||
| await expect(page.locator('.request-tab')).toHaveCount(3); // Overview / Global Environments / Preferences | ||
| }); |
There was a problem hiding this comment.
"Close All Tabs" customized test never invokes the custom shortcut.
The test customizes closeAllTabs to Alt+W+A, opens 3 request tabs, asserts toHaveCount(3), then ends. It never presses Alt+W+A to actually close the tabs and verify the custom binding works. The comment on line 757 even says "Verify all tabs are closed" while asserting count === 3.
Compare with the default test at line 689 which actually presses the shortcut and asserts tabs drop to 1.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js` around lines 696 - 759,
The test sets a custom keybinding for closeAllTabs to Alt+W+A but never triggers
it; after opening and pinning the three request tabs, simulate the custom
shortcut (e.g., emulate the recorded multi-key sequence by sending Alt down,
KeyW down/up, KeyA down/up, then Alt up using page.keyboard like in the earlier
recording block) and then assert the tab count has dropped (use the same locator
'.request-tab' and expect count === 1) to verify the custom binding invoked
closeAllTabs; references: openKeybindingsTab, getEditBtn('closeAllTabs'),
getInput('closeAllTabs'), and the existing page.keyboard down/up sequence used
earlier in the test.
| test('should open environment editor using customized-1 Alt+E+G', async ({ page, createTmpDir }) => { | ||
| // Close all collections, tabs, and preferences first | ||
| await closeAllCollections(page); | ||
|
|
||
| // Close any open preference tabs | ||
| const preferenceTabs = page.locator('.request-tab').filter({ hasText: 'Preferences' }); | ||
| const prefTabCount = await preferenceTabs.count(); | ||
| for (let i = 0; i < prefTabCount; i++) { | ||
| await page.keyboard.press(`${modifier}+KeyW`); | ||
| await page.waitForTimeout(200); | ||
| } | ||
|
|
||
| // Open Keybindings preferences and customize editEnvironment FIRST | ||
| await openKeybindingsTab(page); | ||
|
|
||
| const row = page.getByTestId('keybinding-row-editEnvironment'); | ||
| await row.hover(); | ||
|
|
||
| // Start recording | ||
| await getEditBtn(page, 'editEnvironment').click(); | ||
| await page.waitForTimeout(300); | ||
|
|
||
| // Press new combo: Alt+E+G (multi-key sequence) | ||
| // Use down/up to ensure proper key recording | ||
| await page.keyboard.down('Alt'); | ||
| await page.keyboard.down('KeyE'); | ||
| await page.keyboard.down('KeyG'); | ||
| await page.waitForTimeout(200); | ||
| await page.keyboard.up('KeyG'); | ||
| await page.keyboard.up('KeyE'); | ||
| await page.keyboard.up('Alt'); | ||
| await page.waitForTimeout(500); | ||
|
|
||
| // Verify the keybinding was saved | ||
| const input = getInput(page, 'editEnvironment'); | ||
| const newValue = await input.inputValue(); | ||
| expect(newValue).toContain('alt'); | ||
| expect(newValue).toContain('e'); | ||
| expect(newValue).toContain('g'); | ||
|
|
||
| // Close preferences | ||
| await page.keyboard.press(`${modifier}+KeyW`); | ||
| await page.waitForTimeout(500); | ||
|
|
||
| // Now create collection | ||
| const collectionPath = await createTmpDir('edit-environment-customized-1'); | ||
| await createCollection(page, 'test-collection-environment-customized-1', collectionPath); | ||
|
|
||
| // Wait for collection to be ready | ||
| await page.waitForTimeout(500); | ||
|
|
||
| // Close the environment tab | ||
| await page.keyboard.press(`${modifier}+KeyW`); | ||
| await page.waitForTimeout(300); | ||
|
|
||
| const envTab = page.locator('.request-tab').filter({ hasText: 'Environments' }); | ||
| await expect(envTab).not.toBeVisible(); | ||
| }); |
There was a problem hiding this comment.
"Edit Environment" customized test never invokes the custom shortcut.
The test binds editEnvironment to Alt+E+G and verifies the binding was saved, but never presses Alt+E+G to verify that the environment editor actually opens. Instead, it closes a tab and asserts envTab is not visible — the opposite of what should be tested.
Compare with the default test (line 1003) which presses Cmd/Ctrl+E and asserts the environment tab is visible.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js` around lines 1019 - 1076,
The test sets a custom combo for editEnvironment but never invokes it — instead
it closes tabs and asserts the environment tab is not visible; change the end of
the test to actually trigger the saved shortcut sequence and assert the
environment editor opens: after saving the keybinding (using getEditBtn and
getInput) and closing preferences, simulate the multi-key sequence (Alt down →
KeyE → KeyG → release keys) the same way you recorded it, then await and expect
the envTab locator ('.request-tab' filtered by 'Environments') to be visible;
remove or replace the erroneous close-tab + expect(...).not.toBeVisible()
assertions so the test verifies the environment tab is shown after pressing the
custom shortcut.
| test.describe('FUNCTIONAL: Zoom In', () => { | ||
| test('should zoom in using default Cmd/Ctrl+=', async ({ page, createTmpDir }) => { | ||
| // Close all collections first for clean state | ||
| await closeAllCollections(page); | ||
|
|
||
| const collectionPath = await createTmpDir('zoom-in-default'); | ||
| await createCollection(page, 'test-collection-zoom-in-default', collectionPath); | ||
|
|
||
| // Wait for collection to be ready | ||
| await page.waitForTimeout(500); | ||
|
|
||
| await page.keyboard.press(`${modifier}+Shift+Equal`); | ||
| await page.waitForTimeout(500); | ||
| }); | ||
|
|
||
| test('should zoom in using customized-1 Alt+Z+ArrowUp', async ({ page, createTmpDir }) => { | ||
| // Close all collections, tabs, and preferences first | ||
| await closeAllCollections(page); | ||
|
|
||
| // Close any open preference tabs | ||
| const preferenceTabs = page.locator('.request-tab').filter({ hasText: 'Preferences' }); | ||
| const prefTabCount = await preferenceTabs.count(); | ||
| for (let i = 0; i < prefTabCount; i++) { | ||
| await page.keyboard.press(`${modifier}+KeyW`); | ||
| await page.waitForTimeout(200); | ||
| } | ||
|
|
||
| // Open Keybindings preferences and customize zoomIn FIRST | ||
| await openKeybindingsTab(page); | ||
|
|
||
| const row = page.getByTestId('keybinding-row-zoomIn'); | ||
| await row.hover(); | ||
|
|
||
| // Start recording | ||
| await getEditBtn(page, 'zoomIn').click(); | ||
| await page.waitForTimeout(300); | ||
|
|
||
| // Press new combo: Alt+Z+ArrowUp | ||
| // Use down/up to ensure proper key recording | ||
| await page.keyboard.down('Alt'); | ||
| await page.keyboard.down('KeyZ'); | ||
| await page.keyboard.down('ArrowUp'); | ||
| await page.waitForTimeout(200); | ||
| await page.keyboard.up('ArrowUp'); | ||
| await page.keyboard.up('KeyZ'); | ||
| await page.keyboard.up('Alt'); | ||
| await page.waitForTimeout(1000); | ||
|
|
||
| // Verify the keybinding was saved | ||
| const input = getInput(page, 'zoomIn'); | ||
| const newValue = await input.inputValue(); | ||
| expect(newValue).toContain('alt'); | ||
| expect(newValue).toContain('z'); | ||
| expect(newValue).toContain('arrowup'); | ||
|
|
||
| // Close preferences | ||
| await page.keyboard.press(`${modifier}+KeyW`); | ||
| await page.waitForTimeout(1000); | ||
|
|
||
| // Wait for collection to be ready | ||
| await page.waitForTimeout(500); | ||
|
|
||
| // Press Alt+Z+ArrowUp to zoom in | ||
| await page.keyboard.down('Alt'); | ||
| await page.keyboard.down('KeyZ'); | ||
| await page.keyboard.down('ArrowUp'); | ||
| await page.waitForTimeout(200); | ||
| await page.keyboard.up('ArrowUp'); | ||
| await page.keyboard.up('KeyZ'); | ||
| await page.keyboard.up('Alt'); | ||
| await page.waitForTimeout(500); | ||
| }); |
There was a problem hiding this comment.
Zoom In/Out/Reset tests lack any observable assertion.
The default zoom-in test (lines 1080-1092) presses Cmd/Ctrl+Shift+Equal and then... nothing — no assertion on zoom level. Same for zoom-out (lines 1154-1167) and reset-zoom (lines 1233-1250). The customized variants are similarly assertion-free.
Without verifying zoom factor (e.g., via page.evaluate(() => window.devicePixelRatio) or a known element's computed size), these tests only confirm the shortcut doesn't throw, not that it works.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js` around lines 1079 - 1150,
The zoom tests (tests named "FUNCTIONAL: Zoom In" and the customized variant
using getEditBtn/openKeybindingsTab/getInput) currently only send key events
with no verification; update each zoom-in, zoom-out and reset-zoom test to
capture a measurable zoom indicator before and after the shortcut (e.g., via
page.evaluate(() => window.devicePixelRatio) or computing an element's
computedStyle width/height), then assert the value changed in the expected
direction for zoom-in/zoom-out and returned to the base value for reset-zoom;
use the existing test scaffolding (the test blocks, modifier variable, and
helper functions like getEditBtn and getInput) to place the checks immediately
after the key presses and include clear expect assertions comparing before/after
values.
| const allRequests = page.locator('.collection-item-name'); | ||
| const requestCount = await allRequests.count(); | ||
| await page.waitForTimeout(500); | ||
| expect(requestCount).toBeGreaterThanOrEqual(1); // Should have at least original and pasted |
There was a problem hiding this comment.
Weak assertion: toBeGreaterThanOrEqual(1) doesn't verify paste succeeded.
After copying and pasting, the assertion on line 1689 only checks requestCount >= 1. This passes even if the paste operation failed entirely. Should be >= 2 at minimum, and ideally assert that original-request (1) is visible (the check that existed in the default test at line 1580).
Same issue at line 1816 for the folder copy/paste test.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js` around lines 1686 - 1689,
The assertion using requestCount >= 1 is too weak; update the test that uses
allRequests/page.locator('.collection-item-name') to assert requestCount >= 2 to
ensure the paste created a second item, and also add an explicit visibility
check for the original request (same check used in the default test at line
~1580) to confirm both original and pasted items are present; apply the same
change to the folder copy/paste test around the other failing assertion (near
line 1816) so both tests validate paste success.
| // Reset first to remove old keybindings | ||
| await openKeybindingsTab(page); | ||
| const resetCopyRow = page.getByTestId('keybinding-reset-copyItem'); | ||
| await resetCopyRow.hover(); | ||
| await getResetBtn(page, 'copyItem').click(); |
There was a problem hiding this comment.
openKeybindingsTab called twice in a row.
Lines 1710-1711 call openKeybindingsTab back-to-back. The first call opens Preferences and clicks the Keybindings tab. The second call opens Preferences again (potentially a no-op or creates a duplicate tab) and clicks Keybindings again. This appears to be a copy-paste mistake — the first call on line 1708 already opened the tab.
// Open Keybindings preferences and customize copyItem FIRST
await openKeybindingsTab(page);
- // Reset first to remove old keybindings
- await openKeybindingsTab(page);
const resetCopyRow = page.getByTestId('keybinding-reset-copyItem');🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/shortcuts/preference-shortcuts-edit.spec.js` around lines 1710 - 1714,
There is a duplicate call to openKeybindingsTab() before interacting with
keybinding rows; remove the redundant invocation so the test only calls
openKeybindingsTab() once (the existing call that opens Preferences and clicks
the Keybindings tab) and then proceeds to hover on resetCopyRow and call
getResetBtn(page, 'copyItem').click(); ensure references to openKeybindingsTab,
resetCopyRow, and getResetBtn remain intact.
Screen.Recording.2026-02-19.at.5.37.21.PM.mov |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
tests/collection/moving-tabs/move-tabs.spec.ts (2)
140-141: Drop thewaitForTimeoutcalls after keyboard presses — the followingexpect()assertions auto-retry.Both
await page.waitForTimeout(500)calls at lines 141 and 150 are redundant. Playwright's built-in retry onexpect()already waits for the tab order to settle, so these fixed delays add unnecessary flakiness risk without benefit. As per coding guidelines,page.waitForTimeout()should be avoided unless a locator cannot be found using existingexpect()calls.♻️ Proposed fix
await source.click(); await page.keyboard.press(`${modifier}+BracketLeft`); - await page.waitForTimeout(500); // Verify order of tabs after move await expect(tabs.nth(0)).toHaveText('GETtest-request'); await expect(tabs.nth(1)).toHaveText('test-folder'); // Move the request tab back to its original position using keyboard shortcut await source.click(); await page.keyboard.press(`${modifier}+BracketRight`); - await page.waitForTimeout(500); // Verify order of tabs after move await expect(tabs.nth(0)).toHaveText('test-folder'); await expect(tabs.nth(1)).toHaveText('GETtest-request');Also applies to: 149-150
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/collection/moving-tabs/move-tabs.spec.ts` around lines 140 - 141, Remove the fixed 500ms delays after keyboard interactions: delete the two await page.waitForTimeout(500) calls that follow page.keyboard.press(`${modifier}+BracketLeft`) and the other press at the later occurrence; rely on the existing expect(...) assertions to auto-retry and wait for the tab order to settle instead of using page.waitForTimeout. Ensure the tests still use the same expect(...) calls (the assertions that check tab order/state) so Playwright's retry mechanism covers the state change after page.keyboard.press.
90-155: Promotetest.stepin the keyboard shortcut test for better report readability.The
'Verify tab move by keyboard shortcut'test has several distinct logical phases (create collection, open tabs, verify initial order, move left, verify, move right, verify) but none are wrapped intest.step. As per coding guidelines,test.stepshould be used as much as possible so generated reports are easier to read.♻️ Illustrative structure with `test.step`
test('Verify tab move by keyboard shortcut', async ({ page, createTmpDir }) => { - // Create a collection - await createCollection(...); - ... - // Open the request tab - ... - // Verify order of tabs before move - ... - // Move the request tab before the folder tab using keyboard shortcut - ... - // Verify order of tabs after move - ... + await test.step('Setup: create collection, folder and request', async () => { + await createCollection(...); + // folder + request creation... + }); + + await test.step('Open tabs and verify initial order', async () => { + // dblclick + initial expect... + }); + + await test.step('Move tab left and verify new order', async () => { + await source.click(); + await page.keyboard.press(`${modifier}+BracketLeft`); + await expect(tabs.nth(0)).toHaveText('GETtest-request'); + await expect(tabs.nth(1)).toHaveText('test-folder'); + }); + + await test.step('Move tab right and verify restored order', async () => { + await source.click(); + await page.keyboard.press(`${modifier}+BracketRight`); + await expect(tabs.nth(0)).toHaveText('test-folder'); + await expect(tabs.nth(1)).toHaveText('GETtest-request'); + }); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/collection/moving-tabs/move-tabs.spec.ts` around lines 90 - 155, Wrap the logical phases inside the 'Verify tab move by keyboard shortcut' test with await test.step(...) blocks to improve report readability: group operations like collection creation (operations using createCollection and the sourceCollection locator), folder creation and opening (locators '#folder-name', '.collection-item-name', '.request-tab .tab-label'), request creation and opening (placeholders 'Request Name', '#new-request-url textarea', '.collection-item-name'), initial order verification (tabs = page.locator('.request-tab .tab-label')), moving left (source locator '.request-tab .tab-label' filter hasText 'test-request' and page.keyboard.press(`${modifier}+BracketLeft`)) and moving right (page.keyboard.press(`${modifier}+BracketRight`)) each into their own test.step with descriptive names and await the async callback to preserve existing awaits.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/collection/moving-tabs/move-tabs.spec.ts`:
- Around line 140-141: Remove the fixed 500ms delays after keyboard
interactions: delete the two await page.waitForTimeout(500) calls that follow
page.keyboard.press(`${modifier}+BracketLeft`) and the other press at the later
occurrence; rely on the existing expect(...) assertions to auto-retry and wait
for the tab order to settle instead of using page.waitForTimeout. Ensure the
tests still use the same expect(...) calls (the assertions that check tab
order/state) so Playwright's retry mechanism covers the state change after
page.keyboard.press.
- Around line 90-155: Wrap the logical phases inside the 'Verify tab move by
keyboard shortcut' test with await test.step(...) blocks to improve report
readability: group operations like collection creation (operations using
createCollection and the sourceCollection locator), folder creation and opening
(locators '#folder-name', '.collection-item-name', '.request-tab .tab-label'),
request creation and opening (placeholders 'Request Name', '#new-request-url
textarea', '.collection-item-name'), initial order verification (tabs =
page.locator('.request-tab .tab-label')), moving left (source locator
'.request-tab .tab-label' filter hasText 'test-request' and
page.keyboard.press(`${modifier}+BracketLeft`)) and moving right
(page.keyboard.press(`${modifier}+BracketRight`)) each into their own test.step
with descriptive names and await the async callback to preserve existing awaits.
* feat(phase-1): allow user to customize keybindings * fix: necessary changes for customizied keybindings to work * fix: updated hotkeys provider * fix: test cases for edit keybindings in preferences * fix: removed old keyboard shortcuts test cases * fix: resolved coderabbit coments * fix: fixed move tabs test cases * feat: provided customized keybindings shorcut for codemirror instacnces * fix: handle closetabs/closeAllTabs in RequestTab/index.js for better consitency * fix: resolved comments * fix: resolved zoom issues * fix: revert codemirror instacnces * fix: handle codemirror instances shortcut in .Pass * feat: integrate shorcut keys with codemirror instacneces * fix: ui updates * fix: updated shortcuts * fix: test cases * chore: revert `alt-enter` keybind * chore: allow jest to replace esm spec in store * chore: lint whitespace fix --------- Co-authored-by: shubh-bruno <[email protected]>
…runo#7457) * Revert "feat(phase-1): allow user to customize keybindings (usebruno#7163)" This reverts commit 14532b4. * Revert "chore: UI Polish for Zoom and Keybindings panel (usebruno#7376)" This reverts commit 5151d29.
…y fixes (#19) * fix: import ndjson-curl handling binary data check with type file or not (#7210) * fix: import ndjson-curl handling binary data check with type file * chore: handle ansi escaping manually * chore: avoid duplicate replacements --------- Co-authored-by: shubh-bruno <[email protected]> * fix: env var edit (#7066) * Fix: incorrect translations (#7214) * feat: update req.setHeader translation to use pm.request.headers.add with object argument empty commit * refactor: update req.setHeader translation to use pm.request.headers.upsert * fix: consistent button size on save requests modal (#7197) * Prevent cursor state loss on empty nextValue (#7180) * fix(cli): preserve request item type during import and fail on unsupported types (#7207) * fix(cli): preserve request type when importing collections * fix(cli): fail fast on unsupported imported item types * fix(cli): force BRU format when writing imported files * chore: apply code rabbit fixes * chore: adress review comment - keep changes minimal * add additional test to test bru folder format * agree with coderabbit, error handling is required --------- Co-authored-by: Ramesh Sunkara <[email protected]> * fix: `oauth2 credential` management improvements (#7220) * fix: oauth2 credential management improvements Add bru.resetOauth2Credential() API for programmatic credential invalidation from scripts, fix credential clearing to match on credentialsId, expose oauth2 credential variables in test runtime, and add input validation with deduplication to prevent redundant IPC messages. Remove unused collectionGetOauth2CredentialsByUrlAndCredentialsId reducer. * fix: handle invalid URLs in oauth2 callback redirect handler Wrap new URL() calls in try-catch within onWindowRedirect to prevent uncaught TypeError when redirect or callback URLs are invalid. * Update packages/bruno-app/src/utils/codemirror/autocomplete.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: load shell environment variables on app startup (#7223) Add shell-env integration to fetch environment variables from the user's shell config files (.zshrc, .zshenv, etc.) so that proxy settings and other exports are available in process.env for both Electron and CLI. * feat: add reveal in file manager option to workspace collections menu (#6944) * fix: call initializeShellEnv directly in app ready handler (#7228) Move the shell environment initialization from module-level into the app ready callback, avoiding a dangling promise at import time. * fix: updated error message for renaming requests (#7010) Co-authored-by: shubh-bruno <[email protected]> * fix: collection reorder not persisting after restart (#7093) * feat: implement workspace collection reordering functionality feat: add tests and improve collection reordering functionality fix: handle IPC errors during collection reordering and update tests for persistence validation refactor: enhance collection reordering logic and update related tests for path consistency fix: prevent unnecessary promise resolution in collection reordering when no collections are present * fix: ensure consistent path normalization for workspace collections during reordering * fix: window normlize path comparison (#7240) * feat(CI): refactor github workflow for tests (#7252) * feat: interface zoom control settings (#7255) * feat: interface zoom control settings * fix: allow zoom controls using shortcuts * fix: maintain consitency in zoom shortcuts and ui interface * fix: added min max to 50% and 150% for zoom * fix: moved percentageToZoomLevel function in bruno-common * chore: abstractions --------- Co-authored-by: shubh-bruno <[email protected]> * fix: openapi cli import (#7028) * fix: openapi cli import * chore: seperate bru and opencollection by a flag * fix: pass down format correctly * fix: pass format option correctly in collection tests * Add opencollection version for YAML format Set opencollection version for YAML format. --------- Co-authored-by: Sid <[email protected]> * chore: fix tab selection (#7260) * fix: response viewer not updating when focused (read-only editors) (#7218) * fix: update cursor state handling in CodeEditor for read-only mode * tests: add response pane update test for re-sent requests * refactor: add data-testid attributes for improved testing in RequestBody and RequestBodyMode components; update locators and tests accordingly * test: verify response status code is 200 * test: enhance response pane update tests to verify body editor content after request re-sent * test: add data-testid for method selector and update locators for improved testability * fix: handle special characters in collection path for dotenv watcher (#7190) * fix: handle special characters in collection path for dotenv watcher * fix * fix: normalize collection pathnames in EnvironmentSecretsStore (#7283) * fix: normalize collection pathnames in EnvironmentSecretsStore * fix * fix * fix: phone number faker function (#7046) * fix: skip null query parameters in Postman to Bruno conversion (#7193) * fix: skip null query parameters in Postman to Bruno conversion Updated the importPostmanV2CollectionItem function to skip query parameters where both key and value are null. Added a test case to ensure that such parameters are not included in the converted Bruno collection, while preserving other valid parameters. * fix: skip null parameters in Postman to Bruno conversion Updated the importPostmanV2CollectionItem function to skip headers, URL-encoded parameters, and form data where both key and value are null. Added corresponding test cases to ensure proper handling of these scenarios in the conversion process. * perf: Improve search performance in code editor (#6920) * perf: Improve search performance in code editor Added cache key to reduce duplicate searches over the complete text. Added incremental update logic, to not update every marked entry when clicking "next" or "previous". Fixes: https://github.com/usebruno/bruno/issues/6913 * Update delimeter to unicode symbol * feat: add options to skip request and response bodies in reporter output (#7114) * feat: add options to skip request and response bodies in reporter output - Introduced `--reporter-skip-request-body` and `--reporter-skip-response-body` flags to omit respective bodies from the reporter output. - Updated examples in the CLI documentation to reflect new options. - Refactored result sanitization to handle new flags. * feat: add shorthand option to skip both request and response bodies in reporter output - Introduced `--reporter-skip-body` as a shorthand for omitting both request and response bodies from the reporter output. - Updated CLI documentation examples to include the new shorthand option. - Adjusted result sanitization to accommodate the new option. * refactor: simplify documentation and tests for reporter-skip-body option - Updated the description of the `--reporter-skip-body` option to remove redundancy. - Removed outdated shorthand references from the test suite for clarity. - Cleaned up examples in the CLI documentation to focus on the current functionality. * fix: handle optional chaining for request and response properties in result sanitization - Updated the `sanitizeResultsForReporter` function to use optional chaining when accessing request and response headers and data. - This change prevents potential errors when these properties are undefined. * test: enhance reporter-skip-body tests for JSON and HTML outputs - Added comprehensive tests for the `--reporter-skip-request-body` and `--reporter-skip-response-body` options in both JSON and HTML report formats. - Verified that the appropriate request and response bodies are included or excluded based on the specified flags. - Improved test coverage for scenarios where both flags are used simultaneously. * fix: remove optional chaining for request and response headers in result sanitization - Updated the `sanitizeResultsForReporter` function to directly assign empty objects to request and response headers, ensuring consistent behavior regardless of their initial state. - This change simplifies the code and maintains functionality for skipping headers. * fix: default normalizeProxyUrl to http protocol for all proxy URLs (#7285) * Performance/file parse and mount (#6975) * Refactor: optimize collection updates with batch processing - Introduced BatchAggregator to handle IPC events in batches, reducing Redux dispatch overhead during collection mounting. - Updated collection watcher to utilize batch processing for adding files and directories, improving UI performance. - Implemented ParsedFileCacheStore using LMDB for efficient caching of parsed file content, enhancing loading speed and reducing redundant parsing. - Adjusted collection slice to support batch addition of items, minimizing re-renders and improving state management. - Updated relevant components to reflect changes in loading states and collection data handling. * feat: add cache management to preferences - Introduced a new Cache component in the Preferences section to display cache statistics and allow users to purge the cache. - Implemented IPC handlers for fetching cache stats and purging the cache in the Electron main process. - Added styled components for better UI presentation of cache information. - Updated Preferences component to include a new tab for cache management. * fix: update package-lock.json to change 'devOptional' to 'dev' for several Babel dependencies * refactor: update batch aggregation parameters for improved performance - Increased DISPATCH_INTERVAL_MS from 150ms to 200ms for better timing control. - Adjusted MAX_BATCH_SIZE from 200 to 300 items to enhance batch processing efficiency. * feat: enhance collection loading state and improve batch aggregator functionality - Added isLoading property to collections slice to manage loading state during collection operations. - Updated getAggregator function calls in collection-watcher to include collectionUid for better context in batch processing. - Normalized directory path handling in parsed-file-cache to ensure consistent prefix creation for cache keys. * fix: update loading state and transient file handling in collections slice - Changed isLoading property to false during collection initialization for accurate loading state representation. - Introduced isTransient flag for directories and files to differentiate between transient and non-transient items. - Enhanced logic for handling transient directories and files during collection processing to improve state management. * feat: add batch processing support for file additions in task middleware - Implemented a new listener for collectionBatchAddItems to handle batch file additions. - Enhanced task management by checking for pending OPEN_REQUEST tasks that match added files. - Improved tab management by dispatching addTab actions for matching files and removing corresponding tasks from the queue. * feat: enable ASAR packaging and unpacking for LMDB binaries in Electron build configuration - Added ASAR support to the Electron build configuration for the Bruno application. - Specified unpacking rules for LMDB native binaries to ensure proper loading during runtime. * feat: implement parsed file cache using IndexedDB for improved performance - Introduced a new `parsedFileCacheStore` utilizing IndexedDB for caching parsed file data. - Replaced the previous LMDB-based cache implementation to enhance performance and reliability. - Updated IPC handlers to manage cache operations such as get, set, invalidate, and clear. - Integrated the new cache store into various components, ensuring efficient data retrieval and storage. - Added pruning functionality to remove outdated cache entries on startup. * refactor: update collection root and item handling to preserve UIDs - Modified the way collection roots and folder items are assigned by using `mergeRootWithPreservedUids` and `mergeRequestWithPreservedUids` to ensure UIDs are maintained during updates. - This change enhances data integrity when managing collections and their associated files. * refactor: pass mainWindow reference to parsedFileCacheStore initialization - Updated the `initialize` method in `ParsedFileCacheStore` to accept a `mainWindow` parameter, allowing for direct access to the main window instance in IPC handlers. - This change improves the handling of IPC requests by ensuring the correct window context is used for sending messages. * refactor: optimize getStats method in parsedFileCacheStore for performance - Replaced manual counting of total files with a direct count() call for O(1) performance. - Updated the collection counting logic to utilize openKeyCursor with 'nextunique' for improved efficiency in counting unique collection paths. - These changes enhance the performance of the getStats method by reducing the complexity of file and collection counting. * fix: update key generation in parsedFileCache to use newline separator - Changed the key generation logic in `generateKey` from a null character to a newline character for improved readability and consistency in cache keys. * refactor: rename batch-aggregator to collection-tree-batcher and add tests - Rename BatchAggregator class to CollectionTreeBatcher - Rename getAggregator/removeAggregator to getBatcher/removeBatcher - Update imports and variable names in collection-watcher.js - Add backward-compatible aliases for old names - Add 22 unit tests covering all functionality * refactor: update key generation in parsedFileCache to use custom separator - Changed the key generation logic in `generateKey` to use a custom separator (↝) instead of a newline character for improved readability and consistency in cache keys. * fix: add missing reject handler and fix directory prefix collision - Add reject to Promise and pendingRequests in parsed-file-cache-idb.js - Normalize dirPath with trailing separator in invalidateDirectory to prevent false matches (e.g., /foo/bar matching /foo/barley) - Use platform-specific path.sep for cross-platform compatibility * fix: add error handling in parsedFileCache and update window close event - Added a catch block to handle errors in the database promise in parsedFileCache. - Updated the window close event listener in collection-tree-batcher to use `once` for better resource management. * fix: add LRU eviction when IndexedDB quota is exceeded Handle QuotaExceededError in setEntry by automatically evicting the oldest 20% of cache entries and retrying the write operation. * fix: use once instead of on in mock window for batcher tests --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> * feature: added support for unix sockets and named pipes(windows) for grpc local IPC support (#7021) * Fix Environment Search Behavior, UI Updates, and Result Handling (#7287) * feat: change default collection location to default location (#7291) * feat: change default collection location to default location * refactor: migrate defaultCollectionLocation to defaultLocation in preference.json * refactor: resolveDefaultLocation function * fix: rename variables in default-location * fix: storing status in example for yml file (#6876) * fix: storing status in example for yml file * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: test cases for status and statusText * chore: removed logs * fix: test cases for response status and text * fix: test cases for response status and text * fix: resolved comments * fix: openapi test import test cases * chore: removed console logs * fix: status type in response example while import/export of collection * fix: postman to bruno import --------- Co-authored-by: shubh-bruno <[email protected]> * Feat: Support `multipart/mixed` (#7155) * feat(): support multipart mixed fix: support vars interpolation on mixed multi-part Update packages/bruno-electron/src/ipc/network/interpolate-vars.js Co-authored-by: Timon <[email protected]> refactor: use startsWith feat: best effort for other multipart/* contentypes * feat: enhance variable interpolation for multipart requests - Updated `interpolateVars` function to support interpolation in multipart/form-data and multipart/mixed requests. - Added handling for empty multipart arrays and parts with missing or undefined values. - Improved type checks for content types to ensure proper interpolation behavior. Includes new tests to validate the interpolation functionality for multipart requests. * fix: normalize error handling in sendRequest and improve test reliability --------- Co-authored-by: Alfonso Presa <[email protected]> * fix(graphql): handle invalid schemas gracefully in query editor (#7269) Prevent app crashes when loading GraphQL schemas with validation errors (e.g., object types with no fields). The fix: - Validates schemas using validateSchema() and shows warnings for issues - Still loads the schema so autocomplete continues to work - Wraps the CodeMirror GraphQL linter with error handling to catch any validation errors during linting Fixes #4529 Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix(schema): support all Unicode letters in tag validation (#7311) * allow international characters in tag regex for UI and schema validation * update validation messages to match this Co-authored-by: Miro Metsänheimo <[email protected]> * fix#6247: Interpolate dynamic variables in path param (#6251) * fix: prevent triggering rename action with modifier keys (#7322) * fix(batch-events): fix order of directory file and folder events (#7300) * fix: order of events * fix: update constants handling in CollectionTreeBatcher and related tests * fix: tags validation error for openapi import for BRU and YAML compatibility (#7294) * fix: tags schema updatd to array of string * tests: added test cases for sanitizing tags, openapi-tags * fix: enhance tag sanitization to support object input and UTF characters --------- Co-authored-by: shubh-bruno <[email protected]> * Force text/plain mimetype when copying request code (#7321) * Force text/plain mimetype when copying requests * chore: lint --------- Co-authored-by: Austen Adler <[email protected]> * fix: wrong workspace request shown after closing tab (#7259) * feat: add ensureActiveTabInCurrentWorkspace action and improve tab management * refactor: enhance tab focus logic for current workspace and improve tab management * tests: implement test for getTabToFocusForCurrentWorkspace logic and added a playwright * refactor: improve comments for tab management logic and enhance workspace tab focus handling in tests * refactor: ensure active tab in current workspace after collection removal and enhance tests for tab focus logic * trigger build * Enable encodeUrl setting to control URL encoding in generated snippets (#7187) * feat(snippet-generator): implement encodeUrl setting to control URL encoding in generated snippets * refactor(snippet-generator): rename and enhance URL encoding logic for better clarity and functionality * feat(snippet-generator): enhance raw URL handling to preserve user encoding choices and improve snippet generation * test(snippet-generator): add tests for URL fragment handling based on encodeUrl setting * test(snippet-generator): improve comments on URL fragment handling to clarify RFC compliance * feat(url): enhance interpolateUrlPathParams to support raw URL handling, preserving user encoding choices for snippet generation * fix(url): ensure URLs are prefixed with http:// if missing in interpolateUrlPathParams function * refactor(snippet-generator): streamline URL handling logic to improve snippet generation and ensure proper encoding based on settings * feat(url): add stripOrigin utility to simplify URL processing in snippet generation * test(snippet-generator): add test for double-encoding of pre-encoded URLs when encodeUrl is true * feat(encoding): implement URL encoding settings and add tests for encoding behavior * fix: address PR review comments (#7187) - Remove unnecessary no-op jest.mock for @usebruno/common/utils - Add length guard to prevent catastrophic replaceAll('/') on root-path URLs Co-Authored-By: Claude Opus 4.6 <[email protected]> * empty commit * fix(tests): update interpolateUrlPathParams tests to use correct parameter structure * empty commit --------- Co-authored-by: Claude Opus 4.6 <[email protected]> * feat: implement onboarding preferences and welcome modal for new users (#7319) * feat: implement onboarding preferences and welcome modal for new users * fixes * adding: defaultPreferences * fixes * fix: tests * fixes * fix: test * fix: test * fixes * fixes * Update copyright year to 2026 (#7302) * Update copyright year to 2026 * Update footer year to current year dynamically * fix: Postman import compatibility for multipart form-data file params (#7325) * fix: multipart form-data file param export/import for Postman * fix: Postman import compatibility for multipart form-data file params This commit fixes two issues that caused Postman to fail importing Bruno-exported collections with multipart form-data file parameters: 1. Changed `src` field format to match Postman's export format: - Single file: export as string (e.g., "/path/to/file") - Multiple files: export as array (e.g., ["/path/a", "/path/b"]) - Empty/null: export as null Previously, Bruno always exported `src` as an array, but Postman's importer expects a string for single files and fails to recognize the file type and path when given an array. 2. Added `protocolProfileBehavior.disableBodyPruning` for GET/HEAD/OPTIONS requests that have a body: By default, Postman discards request bodies for HTTP methods that typically don't have bodies (GET, HEAD, OPTIONS). Without this flag, importing a GET request with a form-data body would result in the body being silently dropped, making Postman unable to identify that the request has a formdata body at all. Both changes align Bruno's Postman export format with Postman's own export format, ensuring full import compatibility. --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix(`oauth2`): prevent false callback matches on `root path URLs` (#7315) * fix(oauth2): prevent false callback matches on root path URLs and handle errors first Move error check before callback URL matching in onWindowRedirect so OAuth error responses are rejected immediately. Remove redundant error param check from matchesCallbackUrl and require a code param or hash fragment to match, preventing false positives on intermediate pages when the callback URL is a root path like https://hostname/. * fix(oauth2): clarify error handling comment Remove "on the callback URL" from comment since error checking now happens before callback URL matching. * feat: add `tokenType` support for OAuth2 (#7314) * feat: add tokenType support for OAuth2 * refactor: rename tokenType to source in OpenCollection OAuth2 mapping * refactor: rename tokenType to source in OAuth2 configuration * chore: bump @opencollection/types to ~0.8.0 * fix: correct OAuth2 token type label in token viewer * refactor: replace Dropdown with MenuDropdown in OAuth2 components Migrate all 12 dropdown instances across 5 OAuth2 auth components to use the MenuDropdown component, removing manual tippy ref management and forwardRef icon patterns in favor of a declarative items-based API. * feat: improve stack traces for script and test failures (#7181) * chore: update package-lock.json to include yaml dependency * feat: add script-aware stack traces and source context for script/test failures * chore: sync package-lock.json with yaml dependency in bruno-js * fix: handle null check in getErrorTypeName and align JSDoc style * refactor: derive script path from request.pathname and use SCRIPT_TYPES constant * fix: avoid showing source context for collection/folder script errors * feat: map collection/folder script errors to source file and line * fix: update error formatting and avoid undefined message * fix: resolve script block location in collection/folder yml files * refactor: use script wrapper utils and rename wrapper offsets * refactor: move script wrapper to utils, add wrapScriptInClosure fn * fix: resolved zoom ui remarks (#7326) * fix: resolved zoom ui remarks * fix: resolved comments * fix: resolved comments --------- Co-authored-by: shubh-bruno <[email protected]> * fix: ensure system proxy is initialized before use in network calls (#7264) getCachedSystemProxy now awaits the initialization promise, preventing a race condition where API calls made early in startup would bypass the system proxy. * fix: allow user to delete default bruno headers in pre-request (#7331) * fix: allow user to delete default bruno headers * fix: resolved comments --------- Co-authored-by: shubh-bruno <[email protected]> * feat: add functionality to create new HTTP requests from the welcome modal and collections section (#7350) * feat(sidebar): show "Add request" cta when collection or folder is empty (#7273) * feat(sidebar): show "Add request" cta when collection or folder is empty * fix: add connector lines and keyboard accessibility to empty-state CTA * fix: debounce empty collection state to prevent flicker Add 300ms delay before showing "Add request" button for empty collections. This fixes a race condition where isLoading becomes false before the items batch arrives from IPC, causing a brief flicker of the empty state. Made-with: Cursor --------- Co-authored-by: naman-bruno <[email protected]> * refactor: streamline onboarding process and preferences handling (#7349) * refactor: streamline onboarding process and preferences handling * fixes * fixes * feat(phase-1): allow user to customize keybindings (#7163) * feat(phase-1): allow user to customize keybindings * fix: necessary changes for customizied keybindings to work * fix: updated hotkeys provider * fix: test cases for edit keybindings in preferences * fix: removed old keyboard shortcuts test cases * fix: resolved coderabbit coments * fix: fixed move tabs test cases * feat: provided customized keybindings shorcut for codemirror instacnces * fix: handle closetabs/closeAllTabs in RequestTab/index.js for better consitency * fix: resolved comments * fix: resolved zoom issues * fix: revert codemirror instacnces * fix: handle codemirror instances shortcut in .Pass * feat: integrate shorcut keys with codemirror instacneces * fix: ui updates * fix: updated shortcuts * fix: test cases * chore: revert `alt-enter` keybind * chore: allow jest to replace esm spec in store * chore: lint whitespace fix --------- Co-authored-by: shubh-bruno <[email protected]> * fix: file extension for clone and rename request (#7278) * fix: file extension for clone and rename request * fix * feat: add collection creation flow in SaveTransientRequest modal (#7328) * feat: enhance API spec export with environment variables support (#7170) * feat: enhance API spec export with environment variables support - Updated `exportApiSpec` function to accept and process environment variables for multi-server exports. - Added logic to convert environment variables into a structured format for OpenAPI server entries. - Enhanced the `CreateApiSpec` component to include environments in the exported YAML content. - Introduced unit tests to validate the handling of server variables and their integration into the exported API specifications. * refactor: streamline API spec export logic and improve variable handling - Simplified variable extraction in `exportApiSpec` by directly assigning capture groups. - Updated URL interpolation to use request variables instead of global variables for better accuracy. - Enhanced handling of request body types by replacing early returns with breaks for clearer flow control. - Adjusted tests to ensure backward compatibility with OpenAPI specifications and server variable handling. * refactor: improve variable handling and URL processing in OpenAPI exporters - Streamlined server variable assignment in `exportApiSpec` to handle undefined values more gracefully. - Enhanced URL path extraction to ensure leading slashes are preserved in `getDefaultUrl` and `extractServerVars`. - Updated string replacement logic to use `replaceAll` for consistent variable substitution in URLs. * Fix persistence of additional parameters using open-collection format (#7296) Co-authored-by: TaylorJerry <[email protected]> Co-authored-by: MrcBoo <[email protected]> * feat: inline create collection and workspace editor (#7324) * feat: inline create collection and workspace editor * refactor: use inline collection creation from workspace overview * fix: improve inline collection creation UX from workspace overview * fix: update E2E tests for inline collection creation flow * fix: update default location test for inline collection creation flow * fix: derive inline workspace/collection names from filesystem * feat: inline workspace create form manage workspace * feat: prefill create modal with name * fix: minor code style fixes --------- Co-authored-by: naman-bruno <[email protected]> * chore: update coderabbit instructions to make sure the code is os agnostic (#7355) * refactor: comment out unused APIs (#7323) * refactor: comment out unused API hints in autocomplete.js * refactor: comment out unused API translations in postman and bruno translators Temporarily disable certain API translations due to UI update issues affecting their functionality. A note has been added to restore these translations once the UI fixes are implemented. * refactor: temporarily skip tests for collection variable translations due to UI update issues Commented out tests related to `setCollectionVar`, `deleteCollectionVar`, and related functionalities until the necessary UI updates are implemented. A note has been added to restore these tests once the fixes are live. * refactor: comment out variable deletion and retrieval methods due to UI sync issues * revert: ping.bru * refactor: update postman translation tests to enable previously skipped cases * Revert "Performance/file parse and mount (#6975)" (#7360) * Revert "Performance/file parse and mount (#6975)" This reverts commit f76f487211d3859edf2d14f0b11812811df3a758. * fix: import duplication * Revert "fix(batch-events): fix order of directory file and folder events (#7300)" This reverts commit bf4af42a25522d10f44e1fec17af63b3f0db0077. --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> Co-authored-by: Sid <[email protected]> * fix: show '+ Add request' when only transient items exist (#7361) * fix: focus and text selection in workspace creation flow (#7363) * fix: workspace creation rename focus * refactor: remove duplicate focus/select timer from rename handler * feat/openapi sync (#7279) * feat: implement OpenAPI Sync * feat: enhance focus styles and error handling across components - Added focus-visible styles for buttons and tags in Swagger and Modal components to improve accessibility. - Updated ConnectSpecForm to ensure source URL is set only if the file path is valid. - Enhanced clipboard copy functionality in SpecInfoCard with error handling and success notifications. - Improved ExpandableEndpointRow to handle loading state more robustly. - Refined SyncReviewPage to ensure correct filtering of updated endpoints. - Updated file handling in OpenAPI Sync IPC to support both .yml and .yaml extensions. * fix: improve filename sanitization in OpenAPI Sync IPC - Updated filename sanitization logic to ensure proper handling of both `name` and `filename` properties, enhancing compatibility with various file formats. - Adjusted the logic to derive the base name from the filename when necessary, ensuring consistent output for generated files. * feat: enhance OpenAPI Sync tab with new overview and header components - Introduced OverviewSection to display summary of collection and spec status, including total endpoints, in-sync counts, and pending updates. - Added OpenAPISyncHeader for improved navigation and actions related to the OpenAPI spec. - Updated CollectionStatusSection to better handle and display collection drift information. - Refined styling for status banners and added new visual elements for better user experience. - Enhanced tooltip functionality in Help component for improved accessibility. * refactor: remove VisualDiffViewer components and add diff package - Deleted VisualDiffViewer components including VisualDiffMeta, VisualDiffDocs, VisualDiffVars, and others to streamline the codebase. - Introduced the 'diff' package in package-lock.json to enhance diff functionality. - Updated utility functions to improve diff status handling and maintainability. * feat: enhance OpenAPI Sync tab with sync status indicators and improved styling (#7371) - Added sync status logic to determine if the collection is in sync with the spec, displaying appropriate indicators in the UI. - Updated OpenAPISyncHeader to include linked collection information and sync status icons. - Refined styling in StyledWrapper for better layout and visual feedback on sync status. - Removed unused styles and components to streamline the codebase. * fix: enable `SSL session caching` and `HTTP agent reuse` for faster consecutive requests (#6987) * fix: enable SSL session caching for faster consecutive requests (#6929) * fix: enable SSL session caching for faster consecutive requests Previously, Bruno created a new HTTPS agent for every request, which meant SSL/TLS sessions couldn't be reused. This caused the full TLS handshake (~450ms) to run on every request, even to the same endpoint. Changes: - Add agent caching based on TLS configuration (certs, proxy, SSL options) - Reuse cached agents for requests with matching configuration - SSL sessions are now cached and reused, significantly reducing response time for consecutive requests to the same host The fix maintains backward compatibility: - Timeline logging moved to setup phase (before agent creation) - Proxy and SSL validation behavior unchanged - Added clearAgentCache() for testing and configuration changes Fixes #5574 Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: address review feedback for SSL session caching - Add passphrase to cache key to prevent incorrect agent reuse - Add MAX_AGENT_CACHE_SIZE (100) with LRU-style eviction - Use consistent node: prefix for crypto import Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: lohit <[email protected]> * feat(bruno-requests): add timeline agent for TLS event logging Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): add agent cache for SSL session reuse Co-Authored-By: Claude Opus 4.5 <[email protected]> * test(bruno-requests): add tests for agent cache Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): integrate agent cache into http-https-agents Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor(bruno-electron): use shared agent cache from bruno-requests Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-cli): use agent cache for SSL session reuse Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): add HTTP agent timeline support Add createTimelineHttpAgentClass for logging HTTP connection events including proxy usage, DNS lookups, and connection establishment. Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor(bruno-requests): extract shared agent caching logic Add getOrCreateAgentInternal helper to reduce code duplication between getOrCreateAgent and getOrCreateHttpAgent functions. Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): use HTTP agent cache for connection reuse Export getOrCreateHttpAgent and use it in http-https-agents for HTTP requests to enable connection pooling. Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(bruno-cli): improve HTTP agent handling and error logging - Use { keepAlive: true } instead of tlsOptions for HTTP agents - Add warning log for system proxy configuration errors - Fix brace style consistency Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(bruno-electron): improve HTTP agent handling - Use { keepAlive: true } instead of tlsOptions for HTTP agents - Fix brace style consistency - Add missing newline at EOF Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(bruno-requests): address code review findings for agent caching - Fix Buffer hashing bug: properly handle Buffer values in hashValue() - Add CA array support: new hashCaValue() handles string[] | Buffer[] - Fix timeline race condition: capture timeline reference in closure at createConnection start to isolate concurrent requests - Fix SSL verify message: check socket.authorized for accurate status - Fix HTTP/HTTPS agent logic: only set httpsAgent for HTTPS requests - Add tests for concurrent requests timeline isolation Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): log when reusing cached agent - HTTPS agents: "Reusing cached agent (SSL session reuse enabled)" - HTTP agents: "Reusing cached agent (connection reuse enabled)" Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(preferences): add cache.httpHttpsAgents.enabled preference * feat(agent-cache): add disableCache option to getOrCreateAgent * feat(proxy-util): respect httpHttpsAgents cache preference * refactor(agent-cache): use named props for getOrCreateAgent and getOrCreateHttpAgent * feat(ipc): add renderer:clear-http-https-agent-cache handler * feat(redux): add cache.httpHttpsAgents preferences to initial state * feat(ui): add Cache tab to Preferences * feat(cli): add --disable-http-https-agents-cache flag * refactor(cache): replace window.ipcRenderer calls with redux actions Add getCacheStats, purgeCache, and clearHttpHttpsAgentCache thunks to the app slice. Update the Cache preferences component to dispatch these actions instead of calling window.ipcRenderer directly. Also move handleSave and handleSaveRef above useFormik to fix declaration order — onSubmit closes over handleSaveRef, so the ref must be initialized before useFormik is called. * fix: tests * fix(cache): thread disableCache and hostname through all agent-creation paths - Forward disableHttpHttpsAgentsCache through getHttpHttpsAgents → createAgents so OAuth2 token requests and bru.sendRequest honour the CLI flag - Add hostname to agent cache keys (getAgentCacheKey, getHttpAgentCacheKey) for per-host TLS session reuse; extract hostname at every call site in run-single-request.js, proxy-util.js, and http-https-agents.ts - Add extractHostname helper in http-https-agents.ts to safely parse hostnames - Add test coverage for cert, key, pfx, passphrase, and hostname cache-key differentiation in agent-cache.spec.ts * refactor(cache): rename getOrCreateAgent to getOrCreateHttpsAgent * refactor: simplify UI labels, optimize agent timeline wrapping, silence proxy errors * fix: tests * fix(proxy): fix proxy agent construction and CA cert handling Three fixes: 1. Proxy agents (HttpsProxyAgent, HttpProxyAgent, SocksProxyAgent) expect (proxyUri, options) constructor signature, but the agent cache was packing proxyUri into options as a single argument. Fixed the non-timeline code path in getOrCreateAgentInternal. 2. HTTP requests through an HTTPS proxy need TLS options (ca certs) to validate the proxy's certificate. All getOrCreateHttpAgent call sites now pass TLS options when the proxy protocol is HTTPS. 3. Setting the `ca` option on any Node.js TLS connection replaces the default OpenSSL trust store entirely. CAs only in the OpenSSL default trust store (e.g. /etc/ssl/cert.pem) but not in tls.rootCertificates were lost. Fixed by converting `ca` to a secureContext via addCACert(), which appends custom CAs on top of the OpenSSL defaults instead of replacing them. Also simplified PatchedHttpsProxyAgent to selectively forward only the relevant TLS options (cert, key, pfx, passphrase, rejectUnauthorized, secureContext) to the target TLS upgrade instead of blindly merging all constructor options. * fix(tls): load client certs into secureContext to prevent silent drop Add Cache tab to Preferences UI * fix(proxy): align proxy auth check to use auth.disabled field consistently * refactor(cache): rename CLI flag to --cache-ssl-session and disable caching by default - Rename --disable-http-https-agents-cache to --cache-ssl-session (opt-in) - Rename disableHttpHttpsAgentsCache to cacheSslSession across CLI and bruno-requests - Default caching to disabled in both bruno-electron and bruno-cli - Add cacheSslSession to buildCertsAndProxyConfig for bru.sendRequest - Update Preferences UI labels to "Cache SSL Session" * refactor(cache): rename httpHttpsAgents to sslSession across preferences and UI * refactor(cache): remove unused getCacheStats and purgeCache IPC actions --------- Co-authored-by: karthik <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]> * Feat/opeanpi sync updates (#7374) * fix: update button colors and streamline props in OpenAPISyncTab and CollectionHeader - Changed button color from 'warning' to 'primary' in OpenAPISyncTab for better visual consistency. - Simplified prop usage for OpenAPISyncIcon in CollectionHeader by removing unnecessary function wrapper. * fix: update StatusBadge variant in OpenAPISyncHeader for improved styling - Changed StatusBadge in OpenAPISyncHeader to use 'outline' variant for better visual distinction of version information. * refactor: simplify OpenAPISyncTab and related components by removing unused state and styles (#7378) - Removed the `viewMode` state and associated logic from OpenAPISyncTab and useSyncFlow, streamlining the component's functionality. - Eliminated the `review-active` class from StyledWrapper, cleaning up the styling. - Updated Redux state management by removing `viewMode` from the tab UI state structure, reducing complexity. * chore: UI Polish for Zoom and Keybindings panel (#7376) * chore: ui polishing for zoom panel * fix: replace IconRefresh with IconReload in Zoom and Keybindings components * chore: resolved ui issues * test: check test cases * fix: adjust width properties in StyledWrapper component * fix: update keybindings UI layout and tooltip removal * chore: semantics --------- Co-authored-by: Sid <[email protected]> Co-authored-by: shubh-bruno <[email protected]> * fix: use Title Case for default "Untitled Collection" and "Untitled Workspace" (#7389) * fix: preserve existing process.env values in initializeShellEnv (#7390) * refactor: enhance OpenAPISyncTab functionality and clean up unused code (#7392) - Updated OpenAPISyncTab to utilize Redux state for active tab management, improving state consistency. - Removed unnecessary loading state checks from OverviewSection and SpecStatusSection for cleaner logic. - Streamlined prop usage in OverviewSection by eliminating the isLoading prop. - Cleaned up useOpenAPISync hook by removing unused state clearing logic on unmount. - Improved file handling in openapi-sync IPC by ensuring new files are created in the appropriate folder based on tags. * fix: update collection path handling to use path.join for consistency across components (#7394) * Fix: resolve default location missing path (#7391) * fix: refocus collection name input on error and resolve missing default location folder * revert: remove focus refocus logic from InlineCollectionCreator Reverts the setTimeout focus change that was causing test failures. Keeps the preferences.js fix for default location validation. Made-with: Cursor * fix: update default-collection-location test to use project path Use {{projectRoot}} template variable for defaultLocation so the path exists when the app validates it with fs.existsSync. Made-with: Cursor * fix: improve save test to use alternate path and verify persistence Made-with: Cursor --------- Co-authored-by: naman-bruno <[email protected]> * fix: allow edit keybinding shortcuts (#7404) Co-authored-by: shubh-bruno <[email protected]> * fix: app crash error (Rendered fewer hooks than expected) (#7407) * fix: app crash error (Rendered fewer hooks than expected) * empty commit * enhance OpenAPI sync with validation, enum support, and bug fixes (#7408) * Enhance OpenAPISyncTab functionality with error handling and UI improvements - Updated ConnectSpecForm to include error handling for invalid OpenAPI specifications when uploading files. - Added a sync info notice in CollectionStatusSection to inform users about tracked changes. - Improved styling in StyledWrapper for better visual feedback and layout consistency. - Adjusted button colors and properties in ConfirmSyncModal and ConnectionSettingsModal for better UX. - Refactored useOpenAPISync hook to validate URLs before syncing, ensuring only valid OpenAPI specs are processed. - Enhanced parameter handling in openapi-to-bruno.js to support enum and default values more effectively. * Refactor OpenAPISyncTab components for improved URL validation and error handling - Updated ConnectSpecForm to streamline file upload error handling for OpenAPI specifications. - Enhanced OpenAPISyncHeader to utilize isHttpUrl for better URL validation. - Refactored useOpenAPISync hook to replace isValidUrl with isHttpUrl for consistency in URL checks. - Improved file parsing logic in file-reader.js to handle case-insensitive JSON file extensions. - Added isHttpUrl utility function to validate HTTP/HTTPS URLs effectively. * Enhance file parsing logic in file-reader.js to improve error handling for JSON and YAML files - Updated parseFileAsJsonOrYaml function to handle case-insensitive JSON file extensions more robustly. - Added error handling to ensure the document root is an object and not an array, improving data validation. * Update StatusBadge component to include new 'xs' size preset and adjust documentation accordingly - Added 'xs' size preset with specific font size and padding for minimal use cases. - Updated documentation to reflect the new size options available for the StatusBadge component. * feat(request-pane): restore body tab scroll position on tab switch (#7250) * feat(request-pane): restore body tab scroll position on tab switch When editing large request bodies (JSON/XML/text/sparql), switching to another tab (params, headers, auth, etc.) and back would reset the CodeMirror editor scroll position to the top. Fix by persisting the scroll position to Redux on editor unmount (via CodeEditor's onScroll prop) and restoring it on mount (via initialScroll), mirroring the existing scroll restoration pattern in QueryResultPreview. * test: add playwright tests for body scroll restoration --------- Co-authored-by: naman-bruno <[email protected]> * fix: normalize paths when comparing workspace and redux collection paths on Windows (#7436) Without path normalization, collections appear stuck in "mounting" state on Windows because workspace YAML uses forward slashes while Redux uses backslashes. Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix: multipart header check (#7444) * fix: multipart header check * fix * refactor: update path imports to use utils/common/path (#7440) * workspace renaming with path update (#7437) * workspace renaming with path update * fixes * update: test * fix: test * fix: cookie wrapper callback mode returns never-resolving Promise (#7442) * fix: cookie wrapper callback mode returns never-resolving Promise tough-cookie's createPromiseCallback() intentionally never resolves the returned Promise when a callback is provided — only the callback fires. The cookie jar wrapper was propagating this never-resolving Promise via `return cookieJar.getCookies(url, cb)` in callback-mode paths. When user scripts did `await jar.getCookie(url, name, callback)` in the Node VM (developer sandbox), the await hung forever, blocking the CLI runner. Fix: drop the return value in all callback-mode paths so the wrapper returns void (undefined). `await undefined` resolves immediately. Affected methods: getCookie, getCookies, hasCookie, clear, deleteCookies. * fix: validation-error callback paths also return void instead of callback result The validation guards (e.g. missing URL) did `return callback(error)` which leaks whatever the user's callback returns. Apply the same pattern used for the main callback paths: call the callback, then return void. Also makes deleteCookie's `return executeDelete(callback)` consistent (executeDelete already returns void, but the explicit pattern is clearer). * removed button changed possition to make more acessibility (#7341) * Revert "workspace renaming with path update (#7437)" (#7455) This reverts commit e7c2c7c8722169407d98b8152ed55b3d13f85376. * revert: feat(phase-1): allow user to customize keybindings#7163 (#7457) * Revert "feat(phase-1): allow user to customize keybindings (#7163)" This reverts commit 14532b48a6c55f8020f8b06646dfefaa6559aefa. * Revert "chore: UI Polish for Zoom and Keybindings panel (#7376)" This reverts commit 5151d29aac7c4e607115d0e5d56f31547b9a7a32. * refactor: simplify environment list actions and improve styling (#7459) * Feat/openapi sync beta tag (#7461) * feat: introduce OpenAPI Sync beta feedback feature - Added a feedback section in the OpenAPISyncTab and ConnectSpecForm to encourage user input during the beta phase. - Styled the feedback message and button for better visibility. - Updated the beta features list to include OpenAPI Sync and adjusted related components to reflect its beta status with appropriate badges. - Enhanced the StatusBadge component to support a new 'xs' size for better integration in various UI elements. * feat: integrate OpenAPI Sync beta feature toggle - Updated the ImportCollectionLocation component to conditionally enable the "Check for Spec Updates" option based on the OpenAPI Sync beta feature status. - Modified default preferences to disable OpenAPI Sync by default, ensuring users are not prompted for updates unless explicitly enabled. * feat: enhance beta features integration in Preferences - Updated the BETA_FEATURES array to use constants from utils/beta-features for better maintainability. - Improved the handling of beta preferences by merging new preferences with existing ones, ensuring a smoother user experience when toggling features. * feat: enhance OpenAPI Sync polling with beta feature toggle - Integrated a beta feature toggle for OpenAPI Sync polling, allowing conditional activation based on user settings. - Updated the pollingEnabled logic to incorporate the new beta feature status, ensuring better control over sync behavior. * feat: implement temporary workspace creation and confirmation flow (#7462) * feat: implement temporary workspace creation and confirmation flow * fixes * Replace SpaceX external API with local graphql-yoga mock server (#7471) * chore: switch to locally hosted graphql server * chore: additional graphql check * chore: error handling * feat: integrate deferred loading for saving state in DotEnvFileEditor (#7463) * feat: remove .bru reference in error message (#7479) Co-authored-by: Thomas Vackier <[email protected]> * fix(collection-watcher): prevent crash when deleting collections (#7470) * fix(collection-watcher): guard against events firing after collection deletion When deleting an OpenAPI-synced collection, saveBrunoConfig() writes to bruno.json which creates buffered chokidar events (80ms stabilityThreshold). If the collection directory is removed before those events fire, getCollectionFormat() throws "No collection configuration found" for each .bru file in the collection. Add fs.existsSync(collectionPath) guards in the change, unlink, and unlinkDir handlers to bail out early when the collection root no longer exists. * fix(workspaces): ensure collection watcher stops before deletion Added logic to remove the collection from the watcher when deleting files, preventing chokidar from firing events on a directory that is being removed. This change enhances stability during collection deletions by ensuring the watcher is properly managed. * refactor(workspaces): remove redundant collection watcher logic during deletion Eliminated the logic for stopping the collection watcher before deletion, streamlining the action for removing collections from workspaces. This change simplifies the code and maintains functionality without unnecessary complexity. * test(collection): add integration test for collection deletion functionality Introduced a new test suite to verify the deletion of collections from the workspace overview. The test ensures that collections are properly removed from both the UI and the file system, confirming the absence of any uncaught errors during the deletion process. This addition enhances the test coverage for collection management features. * feat(collection): implement deleteCollectionFromOverview utility function Added a new utility function to delete a collection directly from the workspace overview page. This function encapsulates the steps required to navigate the UI, confirm deletion, and ensure the collection is removed from both the interface and the file system. Updated the corresponding test to utilize this new function, enhancing code reusability and test clarity. * fix(collection-watcher): add guards for collection path existence and error handling Enhanced the unlink and unlinkDir functions to check for the existence of the collection path before proceeding. Added error handling for the getCollectionFormat function to prevent crashes when the collection format cannot be retrieved. These changes improve stability and robustness during collection deletion operations. * feat: improve OpenAPI Sync tab UX and fix sync flow bugs (#7467) * fix: specify OpenAPI 3.x in error messages for file uploads and URL validation Updated error messages in ConnectSpecForm and ConnectionSettingsModal to clarify that only OpenAPI 3.x specifications are valid. Enhanced useOpenAPISync hook to reflect the same specificity in error handling for invalid URLs. * feat(OpenAPISpecTab): add pretty-printing for JSON content in API spec viewer Implemented a new function to pretty-print JSON content for improved readability in the OpenAPISpecTab component. This enhancement ensures that JSON specifications are displayed in a more user-friendly format while leaving YAML content unchanged. * feat(OpenAPISyncHeader): resolve and display absolute file paths for local sources Added functionality to resolve relative file paths to absolute paths for better user experience in the OpenAPISyncHeader component. Implemented state management and side effects to handle path resolution based on the source URL, enhancing the display of local file paths. * feat(OpenAPISyncTab): enhance collection status display and add endpoint counting utility Refactored the CollectionStatusSection to streamline the display of collection drift status, integrating loading states and improved messaging for initial sync scenarios. Introduced a new utility function to count HTTP endpoints in OpenAPI specifications, enhancing the overall functionality of the OpenAPISyncTab. Additionally, updated the OpenAPISyncHeader and OverviewSection to utilize stored specification metadata for better user experience. * refactor: improve OpenAPI Sync endpoint handling - Enhanced the logic for adding new requests by ensuring existing files are verified before removal to prevent accidental deletions. - Streamlined the process of adding new endpoints, including checks for existing files and merging requests to maintain user customizations. - Added comments for clarity on the purpose of changes, particularly regarding filename collision prevention and file content verification. * style(OpenAPISyncTab): update styles for improved visual feedback - Changed background color for the 'type-spec-modified' class to a warning color for better distinction. - Updated text color and background for the SyncReviewPage to enhance readability and visual hierarchy. - Adjusted default expanded states for endpoint sections to improve user experience during sync reviews. * chore: update .gitignore and enhance OpenAPISyncTab components - Added new entries to .gitignore for agent-related files and skills-lock.json. - Modified StyledWrapper to improve overflow handling and added sticky headers for better visibility. - Introduced loading state in SpecDiffModal with a spinner for improved user feedback during rendering. * feat(OpenAPISpecTab): integrate fast-json-format for improved JSON rendering - Replaced the JSON parsing and stringifying logic with fast-json-format for better performance in pretty-printing API specifications. - Updated StyledWrapper in OpenAPISyncTab to change background and text colors for enhanced visual consistency. - Modified DisconnectSyncModal button to include a secondary color for improved visibility during user interactions. * fix(OpenAPISyncTab): correct punctuation in status messages and subtitles - Removed unnecessary trailing periods in messages related to syncing and restoring specifications across CollectionStatusSection and OverviewSection components. - Updated SyncReviewPage to correct grammatical error in the description of spec updates. * fix(OpenAPISyncTab): update URL validation to use isHttpUrl - Replaced isValidUrl with isHttpUrl in ConnectSpecForm and ConnectionSettingsModal components to ensure only valid HTTP URLs are accepted. - Updated the logic for enabling the save button based on the new URL validation method. * fix(OpenAPISyncTab): normalize source URL before validation - Trimmed the source URL in ConnectionSettingsModal to ensure consistent validation with isHttpUrl. - Updated state initialization for URL and filePath to use the normalized source URL, improving handling of user input. * add missing color to scrollbar-color property (#7481) * refactor(OpenAPISyncTab): streamline component logic and enhance user feedback (#7483) - Removed unused props and improved error handling in OpenAPISyncTab components. - Updated messaging in CollectionStatusSection and OverviewSection for clarity. - Enhanced the SpecDiffModal to provide better visual feedback on changes. - Refactored sync flow logic to ensure accurate endpoint categorization and improved performance. - Added new utility functions for better handling of spec changes and endpoint comparisons. * fix: convert non-string variable values to strings during postman import (#7476) * refactor: optimize debounced save functionality (#7495) * fix(RequestTabPanel): update loading message for better user feedback (#7492) Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix(openapi-sync): simplify IPC calls, fix state priorities, and improve stored spec missing UX (#7489) * refactor(OpenAPISyncTab): remove unused props and streamline IPC calls - Eliminated unnecessary sourceUrl prop from various components and hooks in the OpenAPISyncTab. - Improved pretty-printing logic in OpenAPISpecTab to handle non-JSON content gracefully. - Updated IPC calls to remove redundant parameters, enhancing code clarity and maintainability. * feat(OpenAPISyncTab): enhance user interaction and visual feedback - Added onTabSelect prop to OpenAPISyncTab for improved tab navigation. - Updated color properties in StyledWrapper for better consistency with theme. - Replaced IconClock with IconAlertTriangle in CollectionStatusSection for clearer status indication. - Enhanced messaging in OverviewSection and SpecStatusSection to provide clearer user guidance. - Introduced handleRestoreSpec function in useSyncFlow for better spec restoration handling. * fix(OpenAPISyncTab): update button labels for clarity in OverviewSection - Changed button label from 'restore' to 'spec-details' for better context. - Updated the button text from 'View Details' to 'Go to Spec Updates' to enhance user understanding of navigation options. * refactor(OpenAPISyncTab): remove unused props and streamline component logic - Eliminated unnecessary props from OpenAPISyncTab, CollectionStatusSection, and SpecStatusSection for cleaner code. - Removed commented-out code in OverviewSection and SpecStatusSection to enhance readability. - Introduced posixifyPath utility function in filesystem.js to standardize path formatting. * fix(OpenAPISyncTab): update openapi config handling to support array format - Modified the logic in loadBrunoConfig to handle openapi as an array, ensuring consistent resolution of source URLs for all entries. This change improves the configuration handling for OpenAPI specifications. * fix(OpenAPISyncTab): improve openapi config handling and merge logic - Updated loadBrunoConfig to ensure openapi is treated as an array, enhancing source URL resolution. - Modified mergeWithUserValues to handle cases where specItems may be undefined, improving robustness in merging user values with specifications. * feat(bruno-js): add hasCookie function to cookie jar shim for improved cookie management (#7501) * refactor: optimize formik value handling and improve save conditions (#7507) * refactor: optimize formik value handling and improve save conditions * fix * fix: clear draft on save and update dependencies in useEffect (#7512) * feat: include pinned data in filtering for more accurate results in env variables search (#7513) * feat: enhance ScriptError with source context and remove auto-commenting of untranslated pm commands (#7449) * feat: enhance ScriptError with source context, code snippets, and navigation Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: remove auto-commenting of untranslated pm commands during import Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: update CodeSnippet styles to use theme colors for error and warning highlights * fix: remove unused SCRIPT_TYPES import from network IPC module * refactor: remove unused functions and clean up source-context utility - Removed `getUnifiedScriptContext`, `getWarningSourceGroups`, and related helper functions from `source-context.js` to streamline the utility. - Updated tests in `source-context.spec.js` to reflect the removal of unused functions, ensuring only relevant tests for `findLineInSource` and `getScriptContext` remain. * refactor: simplify ScriptError component and update styles * refactor: streamline tab management in Script components * refactor: enhance tab management in ScriptError and add testsMetadata handling in prepare-request * refactor: improve error source identification in ScriptError component - Enhanced the logic for determining error source types by introducing separate checks for folder and collection files. - Updated the handling of folder file names to ensure accurate UID retrieval and labeling. - Streamlined the overall structure of the getErrorSourceInfo function for better readability and maintainability. * refactor: improve ScriptError component and enhance styling - Simplified the conditions for displaying the ScriptError component in ResponsePane. - Updated navigation logic in ScriptErrorCard to ensure proper handling of source information. - Adjusted styles in StyledWrapper to allow for visible overflow. - Enhanced ScriptErrorIcon to accept additional class names for better styling flexibility. - Minor layout adjustments in RunnerResults ResponsePane for improved UI consistency. * refactor: simplify test description for untranslated pm commands and consolidate error formatter imports * fixes * refactor: update focusedTab logic in Script components to use collection and folder UIDthe respective collection and folder UID instead of the activeTabUid. * feat: add buildErrorContext utility for enhanced error handling in network IPC - Introduced a new utility function `buildErrorContext` to construct detailed error context from script errors. - This function parses error locations, adjusts line numbers, and retrieves relevant sou…
* Feat/support missing env apis (#7069) * feat: add support for new variable management functions in Bruno - Implemented methods to retrieve and delete all environment and global variables. - Added corresponding translations for new functions in Postman and Bruno converters. - Updated request handling to include header deletion functionality. - Enhanced test cases to cover new variable management features. * feat: add new scripts for environment and global variable management - Introduced scripts to delete all environment and global variables. - Added functionality to retrieve all environment and global variables. - Implemented tests to validate the behavior of new variable management features. * feat: implement collection variable management in Bruno - Added methods for managing collection variables: set, get, has, delete, and retrieve all. - Updated Postman translation functions to reflect new collection variable methods. - Enhanced tests to validate the functionality of collection variable management. - Refactored existing code to replace environment variable references with collection variable equivalents. * feat: enhance collection variable translations in Bruno - Updated translation functions for collection variable management to align with Postman API. - Added tests for new collection variable methods: set, has, delete, retrieve all, and clear. - Refactored existing tests to ensure accurate translation of collection variable operations. * feat: expand API hints for variable management in Bruno * fix: test cases * fix: remove unnecessary return in deleteEnvVar function * fix: cURL import NDJSON in request body as text (#7002) * fix: cURL import NDJSON request body as text * fix: cURL import NDJSON request body as text * fix: cURL import NDJSON request body as text * fix: resolved comments for body.text * fix: add NDJSON content type detection --------- Co-authored-by: shubh-bruno <[email protected]> * Feature/scratch requests (#7087) * feat: implement workspace-level scratch requests Add support for temporary "scratch" requests at the workspace level that are not tied to any collection. These requests are stored in a temp directory and displayed as tabs in the workspace home. Key changes: - Add IPC handlers for mounting scratch directory and creating requests - Add scratch directory watcher in collection-watcher.js - Extend workspaces Redux slice with scratch state and reducers - Add IPC listeners for scratch request events - Create ScratchRequestPane and CreateScratchRequest components - Update WorkspaceTabs with "+" button for creating scratch requests - Update WorkspaceHome to render scratch request tabs - Filter scratch collections from sidebar display Supports all request types: HTTP, GraphQL, gRPC, and WebSocket. * style: improve create scratch request button styling - Use Button component with ghost variant and primary color - Position button inside scrollable tab area - Vertically center button with tabs - Clean up unnecessary CSS properties * fix: append scratch request dropdown to body to fix z-index issue * refactor: improve scratch collection detection with path registration - Add centralized scratch path tracking in backend (scratchCollectionPaths Set) - Register scratch paths when created via renderer:mount-workspace-scratch - Set brunoConfig.type='scratch' based on registered paths instead of string pattern - Store scratchTempDirectory path in workspace state for frontend validation - Update schema to accept 'scratch' as valid collection type - Simplify frontend filtering to use brunoConfig.type or path comparison - Remove fragile 'bruno-scratch-' string pattern matching - Prevent scratch collections from being added to workspace.collections * refactor: use CreateTransientRequest for scratch requests in workspace tabs - Remove CreateScratchRequest component in favor of reusing CreateTransientRequest - Register scratch collection temp directory via addTransientDirectory for transient request creation - Add scratch collection item sync with workspace tabs - Display HTTP method with color on scratch request tabs * refactor: unify WorkspaceTabs with RequestTabs system Remove separate WorkspaceTabs system and integrate workspace views (Overview, Environments) into the unified RequestTabs architecture using scratch collections. Key changes: - Remove WorkspaceTabs component and Redux slice - Add workspaceOverview and workspaceEnvironments as special tab types - Create WorkspaceHeader component to display workspace name in toolbar - Make workspace tabs non-closable and always present - Update tab creation on workspace switch to automatically add Overview and Environments tabs - Simplify WorkspaceHome component by removing redundant header - Update all references from WorkspaceTabs to unified tab system Benefits: - Single tab system for all content (collections and workspace views) - Consistent UX with unified navigation pattern - Reduced code complexity (~1000+ lines removed) - Easier maintenance and feature development * fix: enable automatic tab creation for scratch collection transient requests - Add updateCollectionMountStatus to properly set scratch collection mount status to 'mounted' - Create new renderer:add-collection-watcher IPC handler for explicit watcher setup - Move workspace tab type checks before collection validation in RequestTabPanel - Update mountScratchCollection to use explicit watcher setup instead of open-multiple-collections This ensures the task middleware recognizes scratch collections as fully mounted, allowing transient requests to automatically open in tabs when created. * feat: add collection selector with breadcrumb navigation for scratch requests Add multi-step save flow for scratch collection requests with collection selection before folder selection. Includes breadcrumb navigation showing "Collections > [Selected Collection] > [Folders...]" that allows users to navigate back to collection selector. Refactor scratch collection detection to use workspace.scratchCollectionUid instead of persisting type to brunoConfig, providing cleaner separation of concerns without disk persistence. Add backend support for automatic format conversion when saving from YAML scratch collections to BRU collections. * chore: remove redundant comments and simplify code * fix: use focusTab for home button, remove unused ScratchRequestPane * fix: improve SaveTransientRequest collection mounting and selection flow * refactor: use WorkspaceOverview directly, remove WorkspaceHome wrapper * feat: add workspace management dropdown with rename, export, and close options * refactor: extract CollectionListItem component with Redux selector for mount status * refactor: separate scratch collection handling from openCollectionEvent - Create dedicated openScratchCollectionEvent function for scratch collections - Revert openCollectionEvent to clean state without scratch-specific logic - Simplify closeTabs and closeAllCollectionTabs reducers in tabs slice - Remove unused isScratchCollectionPath helper function * test: add scratch requests test suite - Add tests for creating scratch requests (HTTP, GraphQL, gRPC, WebSocket) - Add tests for sending scratch requests and verifying response - Add tests for saving scratch requests to a collection - Add tests for multiple tabs and closing tabs - Handle "Don't Save" modal in playwright fixture during app close * refactor: address code review feedback for scratch requests feature - Fix RequestTabPanel hooks violation by moving SSR guard after hooks - Fix validateWorkspaceName to trim before length check - Use stable deterministic UID in SaveTransientRequest - Use ES6 shorthand for collectionUid in useIpcEvents - Add JSDoc and error handling to openScratchCollectionEvent - Fix closeAllCollectionTabs to preserve activeTabUid when not removed - Add syncExampleUidsCache call to save-scratch-request handler - Use getCollectionFormat for save-transient-request extension handling - Fix Playwright modal handling with proper waitFor pattern - Make keyboard shortcut platform-aware in scratch tests - Remove flaky close tab test, handled by fixture cleanup - Extract isScratchCollection utility to reduce duplication - Memoize scratch collection derivation in RequestTabs - Use theme color instead of Tailwind class for success icon - Wrap resetForm and handleCancelWorkspaceRename in useCallback - Extract FolderBreadcrumbs into separate component - Call reset() inside useEffect in useCollectionFolderTree hook - Defer workspace scratch state updates until mount succeeds * feat: add unified collection header with context switcher dropdown - Create CollectionHeader component that replaces WorkspaceHeader and CollectionToolBar - Add dropdown to switch between workspace and mounted collections - Display tab count badge next to collection/workspace name in header and dropdown - Remove unused WorkspaceHeader and CollectionToolBar components - Handle null/undefined values elegantly throughout * chore: allow pr to comment * refactor: improve scratch requests test cleanup with closeAllTabs helper - Revert playwright/index.ts modal handling hack - Add closeAllTabs helper to test utils for proper tab cleanup - Update scratch-requests test to use closeAllTabs in afterAll - Fix test assertion for new collection header dropdown structure --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix: env draft loss on color change and rename (#7130) * tests: fix breaking tests (#7132) * fix: update placeholder text for environment variable input * fix: handle undefined color in environment objects Don't export if `undefined` * fix: update collection import logic for YML and BRU formats * fix: ensure error icon is not visible after header validation * fix: specify format for collection and environment serialization * feat: move import collection from git url and spec url from enterprise edition to opensource (#7127) * feat: move import collection from git url and spec url from enterprise edition to opensource * fix: corrected a typo * test: add unit and e2e tests for import collection migration * fix: guard against missing userAgentData platform in getOSName — Default platform to '' to prevent TypeError when navigator.userAgentData is unavailable (GitNotFoundModal/index.js) fix: UID mismatch between status tracking and UI rendering in bulk import — Preserve synthetic file-${index} UID on converted collections so initialStatus, rename tracking, and the render loop all use the same key (BulkImportCollectionLocation/index.js) fix: isConfirmDisabled returning non-boolean value — Changed .length checks to explicit comparisons (> 0, === 0) so the function always returns true/false (CloneGitRespository/index.js) fix: missing ipcRenderer declaration in cloneGitRepository and scanForBrunoFiles — Added const { ipcRenderer } = window; to both actions to prevent ReferenceError at runtime (collections/actions.js) fix: use strict equality in filterItemsInCollection — Changed == to === for item.name and item.type comparisons (importers/common.js) fix: variable shadowing in transformItemsInCollection and hydrateSeqInCollection — Renamed forEach callback parameter from collection to col to avoid shadowing the outer parameter (importers/common.js) fix: scanForBrunoFiles traversing node_modules and .git directories — Added exclusion for node_modules and .git to match getCollectionStats pattern, preventing app freezes on large repos (filesystem.js) fix: diff hunk header using string character count instead of line count — Preserved prefixedLines array to compute lineCount before joining, so the @@ header has the correct line count (git.js) fix: test locators not scoped to modal in bulk import e2e test — Changed page.getByTestId to bulkImportModal.getByTestId for grouping dropdown interactions (002-all-collection-types.spec.ts) fix: missing afterEach cleanup in GitHub repository import test — Added closeAllCollections hook to match sibling test specs, replaced unused dotenv/config import (github-repository-import.spec.ts) * fix: batch name tracking and git utility fixes - Fix usedNamesInBatch tracking original name instead of final name, which could produce duplicate environment names within the same batch (BulkImportCollectionLocation/index.js) - Remove unused lodash import (git.js) - Add missing early return in fetchRemotes when gitRootPath is falsy, preventing getSimpleGitInstanceForPath from running with undefined (git.js) * fix: correct variable naming and state management in CloneGitRepository component - Renamed `collectionpaths` to `collectionPaths` for consistency and clarity. - Updated references throughout the component to use the corrected variable name. - Removed error toast notification to streamline error handling during repository cloning. * fix: update header validation test to use triple-click for selecting all text (#7140) * fix: flaky tests - standardize save keyboard shortcut across tests (#7141) * chore: fix flaky tests (#7144) * feat: remove headers from request using scripts (#7122) * fix: improve visual hierarchy of markdown headers in docs (#7145) * fix: importing from openapi excludes documentation for requests (#6439) * fix: importing from openapi excludes documentation for requests fixes issue 5094 for requests * fix: revert accidental changes --------- Co-authored-by: Simon PAUGET <[email protected]> Co-authored-by: Simon PAUGET <[email protected]> * fix: incorrect response formatting when saving examples (#6528) * Feature: Object Variable Interpolation (#6317) * Added JSON stringify for object values to allow for proper display Added styling changes to accommodate objects * Switching to a multi line approach * feat: add some doc about variable usage (#6443) * add some doc about variable usage * add some doc about variable usage * add some doc about variable usage * chore: fix flaky playwright tests (#7159) * fix: update protobuf and import path handling in opencollection (#7166) * fix: sse response download button (#7081) Co-authored-by: Sid <[email protected]> * fix: parsing dates from insomnia (#7003) js-yaml uses DEFAULT_SCHEMA by default and implicitly casts date-like strings to Date (timestamp). This caused unexpected config values where dates were supposed to remain plain strings. Switched YAML parsing to JSON_SCHEMA to disable timestamp resolution and keep date-like values as strings. * fix cookies not being set when follow redirect = false (#6679) * fix follow redirect cookies not being set * Set default value of followredirects in axios-instance Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Jeroen Vinke <[email protected]> Co-authored-by: Copilot <[email protected]> * chore(playwright): enhance playwright config to reduce flakiness (#7174) * update redux state to keep currently active script tab in state (#6947) * feature/f2-rename-shortcut (#7077) * feature/f2-rename-shortcut * feat(hotkeys): added OS-specific key bindings for renaming items * fix(hotkeys): updated hotkey function call to somethhing more performant and standard * fix: `isJson` assertion fails after `res.setBody()` with object in `node-vm` (#7191) * fix: isJson assertion fails after res.setBody() with object in node-vm Objects created inside Node's vm.createContext() have a different Object constructor than the host realm. When res.setBody() is called with a JS object from a script, _.cloneDeep preserves the cross-realm prototype, causing obj.constructor === Object to fail in the isJson assertion. Replace with Object.prototype.toString.call() which is cross-realm safe. * fix: register isJson chai assertion in QuickJS test runtime The bundled chai in QuickJS only exposes { expect, assert } via requireObject — no Assertion class. Access the prototype through Object.getPrototypeOf(expect(null)) and use Object.defineProperty to register the json property directly. * fix: enable assertion chaining on isJson in QuickJS runtime The QuickJS isJson property getter was missing `return this`, preventing chai assertion chaining (e.g. expect(body).to.be.json.and...). * fix: change transient request directory from os temp to app data (#7184) * fix: change transient request directory from os temp to app data Move transient request files from os.tmpdir() to app.getPath('userData')/transient to prevent data loss when the OS clears temporary files. Changes: - Add helper functions for transient directory paths - Update findCollectionPathByItemPath to use new transient path check - Update renderer:mount-collection to create temp dirs in app data - Update renderer:mount-workspace-scratch to create temp dirs in app data - Update renderer:delete-transient-requests prefix validation * change transient directory path to userData/tmp/transient --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> Co-authored-by: naman-bruno <[email protected]> * fix: normalize Windows paths for cross-platform compatibility (#7185) * fix: normalize Windows paths for cross-platform compatibility in workspace * fixes * fix: collection scope undefined var (#7211) * fix: import ndjson-curl handling binary data check with type file or not (#7210) * fix: import ndjson-curl handling binary data check with type file * chore: handle ansi escaping manually * chore: avoid duplicate replacements --------- Co-authored-by: shubh-bruno <[email protected]> * fix: env var edit (#7066) * Fix: incorrect translations (#7214) * feat: update req.setHeader translation to use pm.request.headers.add with object argument empty commit * refactor: update req.setHeader translation to use pm.request.headers.upsert * fix: consistent button size on save requests modal (#7197) * Prevent cursor state loss on empty nextValue (#7180) * fix(cli): preserve request item type during import and fail on unsupported types (#7207) * fix(cli): preserve request type when importing collections * fix(cli): fail fast on unsupported imported item types * fix(cli): force BRU format when writing imported files * chore: apply code rabbit fixes * chore: adress review comment - keep changes minimal * add additional test to test bru folder format * agree with coderabbit, error handling is required --------- Co-authored-by: Ramesh Sunkara <[email protected]> * fix: `oauth2 credential` management improvements (#7220) * fix: oauth2 credential management improvements Add bru.resetOauth2Credential() API for programmatic credential invalidation from scripts, fix credential clearing to match on credentialsId, expose oauth2 credential variables in test runtime, and add input validation with deduplication to prevent redundant IPC messages. Remove unused collectionGetOauth2CredentialsByUrlAndCredentialsId reducer. * fix: handle invalid URLs in oauth2 callback redirect handler Wrap new URL() calls in try-catch within onWindowRedirect to prevent uncaught TypeError when redirect or callback URLs are invalid. * Update packages/bruno-app/src/utils/codemirror/autocomplete.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: load shell environment variables on app startup (#7223) Add shell-env integration to fetch environment variables from the user's shell config files (.zshrc, .zshenv, etc.) so that proxy settings and other exports are available in process.env for both Electron and CLI. * feat: add reveal in file manager option to workspace collections menu (#6944) * fix: call initializeShellEnv directly in app ready handler (#7228) Move the shell environment initialization from module-level into the app ready callback, avoiding a dangling promise at import time. * fix: updated error message for renaming requests (#7010) Co-authored-by: shubh-bruno <[email protected]> * fix: collection reorder not persisting after restart (#7093) * feat: implement workspace collection reordering functionality feat: add tests and improve collection reordering functionality fix: handle IPC errors during collection reordering and update tests for persistence validation refactor: enhance collection reordering logic and update related tests for path consistency fix: prevent unnecessary promise resolution in collection reordering when no collections are present * fix: ensure consistent path normalization for workspace collections during reordering * fix: window normlize path comparison (#7240) * feat(CI): refactor github workflow for tests (#7252) * feat: interface zoom control settings (#7255) * feat: interface zoom control settings * fix: allow zoom controls using shortcuts * fix: maintain consitency in zoom shortcuts and ui interface * fix: added min max to 50% and 150% for zoom * fix: moved percentageToZoomLevel function in bruno-common * chore: abstractions --------- Co-authored-by: shubh-bruno <[email protected]> * fix: openapi cli import (#7028) * fix: openapi cli import * chore: seperate bru and opencollection by a flag * fix: pass down format correctly * fix: pass format option correctly in collection tests * Add opencollection version for YAML format Set opencollection version for YAML format. --------- Co-authored-by: Sid <[email protected]> * chore: fix tab selection (#7260) * fix: response viewer not updating when focused (read-only editors) (#7218) * fix: update cursor state handling in CodeEditor for read-only mode * tests: add response pane update test for re-sent requests * refactor: add data-testid attributes for improved testing in RequestBody and RequestBodyMode components; update locators and tests accordingly * test: verify response status code is 200 * test: enhance response pane update tests to verify body editor content after request re-sent * test: add data-testid for method selector and update locators for improved testability * fix: handle special characters in collection path for dotenv watcher (#7190) * fix: handle special characters in collection path for dotenv watcher * fix * fix: normalize collection pathnames in EnvironmentSecretsStore (#7283) * fix: normalize collection pathnames in EnvironmentSecretsStore * fix * fix * fix: phone number faker function (#7046) * fix: skip null query parameters in Postman to Bruno conversion (#7193) * fix: skip null query parameters in Postman to Bruno conversion Updated the importPostmanV2CollectionItem function to skip query parameters where both key and value are null. Added a test case to ensure that such parameters are not included in the converted Bruno collection, while preserving other valid parameters. * fix: skip null parameters in Postman to Bruno conversion Updated the importPostmanV2CollectionItem function to skip headers, URL-encoded parameters, and form data where both key and value are null. Added corresponding test cases to ensure proper handling of these scenarios in the conversion process. * perf: Improve search performance in code editor (#6920) * perf: Improve search performance in code editor Added cache key to reduce duplicate searches over the complete text. Added incremental update logic, to not update every marked entry when clicking "next" or "previous". Fixes: https://github.com/usebruno/bruno/issues/6913 * Update delimeter to unicode symbol * feat: add options to skip request and response bodies in reporter output (#7114) * feat: add options to skip request and response bodies in reporter output - Introduced `--reporter-skip-request-body` and `--reporter-skip-response-body` flags to omit respective bodies from the reporter output. - Updated examples in the CLI documentation to reflect new options. - Refactored result sanitization to handle new flags. * feat: add shorthand option to skip both request and response bodies in reporter output - Introduced `--reporter-skip-body` as a shorthand for omitting both request and response bodies from the reporter output. - Updated CLI documentation examples to include the new shorthand option. - Adjusted result sanitization to accommodate the new option. * refactor: simplify documentation and tests for reporter-skip-body option - Updated the description of the `--reporter-skip-body` option to remove redundancy. - Removed outdated shorthand references from the test suite for clarity. - Cleaned up examples in the CLI documentation to focus on the current functionality. * fix: handle optional chaining for request and response properties in result sanitization - Updated the `sanitizeResultsForReporter` function to use optional chaining when accessing request and response headers and data. - This change prevents potential errors when these properties are undefined. * test: enhance reporter-skip-body tests for JSON and HTML outputs - Added comprehensive tests for the `--reporter-skip-request-body` and `--reporter-skip-response-body` options in both JSON and HTML report formats. - Verified that the appropriate request and response bodies are included or excluded based on the specified flags. - Improved test coverage for scenarios where both flags are used simultaneously. * fix: remove optional chaining for request and response headers in result sanitization - Updated the `sanitizeResultsForReporter` function to directly assign empty objects to request and response headers, ensuring consistent behavior regardless of their initial state. - This change simplifies the code and maintains functionality for skipping headers. * fix: default normalizeProxyUrl to http protocol for all proxy URLs (#7285) * Performance/file parse and mount (#6975) * Refactor: optimize collection updates with batch processing - Introduced BatchAggregator to handle IPC events in batches, reducing Redux dispatch overhead during collection mounting. - Updated collection watcher to utilize batch processing for adding files and directories, improving UI performance. - Implemented ParsedFileCacheStore using LMDB for efficient caching of parsed file content, enhancing loading speed and reducing redundant parsing. - Adjusted collection slice to support batch addition of items, minimizing re-renders and improving state management. - Updated relevant components to reflect changes in loading states and collection data handling. * feat: add cache management to preferences - Introduced a new Cache component in the Preferences section to display cache statistics and allow users to purge the cache. - Implemented IPC handlers for fetching cache stats and purging the cache in the Electron main process. - Added styled components for better UI presentation of cache information. - Updated Preferences component to include a new tab for cache management. * fix: update package-lock.json to change 'devOptional' to 'dev' for several Babel dependencies * refactor: update batch aggregation parameters for improved performance - Increased DISPATCH_INTERVAL_MS from 150ms to 200ms for better timing control. - Adjusted MAX_BATCH_SIZE from 200 to 300 items to enhance batch processing efficiency. * feat: enhance collection loading state and improve batch aggregator functionality - Added isLoading property to collections slice to manage loading state during collection operations. - Updated getAggregator function calls in collection-watcher to include collectionUid for better context in batch processing. - Normalized directory path handling in parsed-file-cache to ensure consistent prefix creation for cache keys. * fix: update loading state and transient file handling in collections slice - Changed isLoading property to false during collection initialization for accurate loading state representation. - Introduced isTransient flag for directories and files to differentiate between transient and non-transient items. - Enhanced logic for handling transient directories and files during collection processing to improve state management. * feat: add batch processing support for file additions in task middleware - Implemented a new listener for collectionBatchAddItems to handle batch file additions. - Enhanced task management by checking for pending OPEN_REQUEST tasks that match added files. - Improved tab management by dispatching addTab actions for matching files and removing corresponding tasks from the queue. * feat: enable ASAR packaging and unpacking for LMDB binaries in Electron build configuration - Added ASAR support to the Electron build configuration for the Bruno application. - Specified unpacking rules for LMDB native binaries to ensure proper loading during runtime. * feat: implement parsed file cache using IndexedDB for improved performance - Introduced a new `parsedFileCacheStore` utilizing IndexedDB for caching parsed file data. - Replaced the previous LMDB-based cache implementation to enhance performance and reliability. - Updated IPC handlers to manage cache operations such as get, set, invalidate, and clear. - Integrated the new cache store into various components, ensuring efficient data retrieval and storage. - Added pruning functionality to remove outdated cache entries on startup. * refactor: update collection root and item handling to preserve UIDs - Modified the way collection roots and folder items are assigned by using `mergeRootWithPreservedUids` and `mergeRequestWithPreservedUids` to ensure UIDs are maintained during updates. - This change enhances data integrity when managing collections and their associated files. * refactor: pass mainWindow reference to parsedFileCacheStore initialization - Updated the `initialize` method in `ParsedFileCacheStore` to accept a `mainWindow` parameter, allowing for direct access to the main window instance in IPC handlers. - This change improves the handling of IPC requests by ensuring the correct window context is used for sending messages. * refactor: optimize getStats method in parsedFileCacheStore for performance - Replaced manual counting of total files with a direct count() call for O(1) performance. - Updated the collection counting logic to utilize openKeyCursor with 'nextunique' for improved efficiency in counting unique collection paths. - These changes enhance the performance of the getStats method by reducing the complexity of file and collection counting. * fix: update key generation in parsedFileCache to use newline separator - Changed the key generation logic in `generateKey` from a null character to a newline character for improved readability and consistency in cache keys. * refactor: rename batch-aggregator to collection-tree-batcher and add tests - Rename BatchAggregator class to CollectionTreeBatcher - Rename getAggregator/removeAggregator to getBatcher/removeBatcher - Update imports and variable names in collection-watcher.js - Add backward-compatible aliases for old names - Add 22 unit tests covering all functionality * refactor: update key generation in parsedFileCache to use custom separator - Changed the key generation logic in `generateKey` to use a custom separator (↝) instead of a newline character for improved readability and consistency in cache keys. * fix: add missing reject handler and fix directory prefix collision - Add reject to Promise and pendingRequests in parsed-file-cache-idb.js - Normalize dirPath with trailing separator in invalidateDirectory to prevent false matches (e.g., /foo/bar matching /foo/barley) - Use platform-specific path.sep for cross-platform compatibility * fix: add error handling in parsedFileCache and update window close event - Added a catch block to handle errors in the database promise in parsedFileCache. - Updated the window close event listener in collection-tree-batcher to use `once` for better resource management. * fix: add LRU eviction when IndexedDB quota is exceeded Handle QuotaExceededError in setEntry by automatically evicting the oldest 20% of cache entries and retrying the write operation. * fix: use once instead of on in mock window for batcher tests --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> * feature: added support for unix sockets and named pipes(windows) for grpc local IPC support (#7021) * Fix Environment Search Behavior, UI Updates, and Result Handling (#7287) * feat: change default collection location to default location (#7291) * feat: change default collection location to default location * refactor: migrate defaultCollectionLocation to defaultLocation in preference.json * refactor: resolveDefaultLocation function * fix: rename variables in default-location * fix: storing status in example for yml file (#6876) * fix: storing status in example for yml file * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: temporary check for tests * fix: test cases for status and statusText * chore: removed logs * fix: test cases for response status and text * fix: test cases for response status and text * fix: resolved comments * fix: openapi test import test cases * chore: removed console logs * fix: status type in response example while import/export of collection * fix: postman to bruno import --------- Co-authored-by: shubh-bruno <[email protected]> * Feat: Support `multipart/mixed` (#7155) * feat(): support multipart mixed fix: support vars interpolation on mixed multi-part Update packages/bruno-electron/src/ipc/network/interpolate-vars.js Co-authored-by: Timon <[email protected]> refactor: use startsWith feat: best effort for other multipart/* contentypes * feat: enhance variable interpolation for multipart requests - Updated `interpolateVars` function to support interpolation in multipart/form-data and multipart/mixed requests. - Added handling for empty multipart arrays and parts with missing or undefined values. - Improved type checks for content types to ensure proper interpolation behavior. Includes new tests to validate the interpolation functionality for multipart requests. * fix: normalize error handling in sendRequest and improve test reliability --------- Co-authored-by: Alfonso Presa <[email protected]> * fix(graphql): handle invalid schemas gracefully in query editor (#7269) Prevent app crashes when loading GraphQL schemas with validation errors (e.g., object types with no fields). The fix: - Validates schemas using validateSchema() and shows warnings for issues - Still loads the schema so autocomplete continues to work - Wraps the CodeMirror GraphQL linter with error handling to catch any validation errors during linting Fixes #4529 Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix(schema): support all Unicode letters in tag validation (#7311) * allow international characters in tag regex for UI and schema validation * update validation messages to match this Co-authored-by: Miro Metsänheimo <[email protected]> * fix#6247: Interpolate dynamic variables in path param (#6251) * fix: prevent triggering rename action with modifier keys (#7322) * fix(batch-events): fix order of directory file and folder events (#7300) * fix: order of events * fix: update constants handling in CollectionTreeBatcher and related tests * fix: tags validation error for openapi import for BRU and YAML compatibility (#7294) * fix: tags schema updatd to array of string * tests: added test cases for sanitizing tags, openapi-tags * fix: enhance tag sanitization to support object input and UTF characters --------- Co-authored-by: shubh-bruno <[email protected]> * Force text/plain mimetype when copying request code (#7321) * Force text/plain mimetype when copying requests * chore: lint --------- Co-authored-by: Austen Adler <[email protected]> * fix: wrong workspace request shown after closing tab (#7259) * feat: add ensureActiveTabInCurrentWorkspace action and improve tab management * refactor: enhance tab focus logic for current workspace and improve tab management * tests: implement test for getTabToFocusForCurrentWorkspace logic and added a playwright * refactor: improve comments for tab management logic and enhance workspace tab focus handling in tests * refactor: ensure active tab in current workspace after collection removal and enhance tests for tab focus logic * trigger build * Enable encodeUrl setting to control URL encoding in generated snippets (#7187) * feat(snippet-generator): implement encodeUrl setting to control URL encoding in generated snippets * refactor(snippet-generator): rename and enhance URL encoding logic for better clarity and functionality * feat(snippet-generator): enhance raw URL handling to preserve user encoding choices and improve snippet generation * test(snippet-generator): add tests for URL fragment handling based on encodeUrl setting * test(snippet-generator): improve comments on URL fragment handling to clarify RFC compliance * feat(url): enhance interpolateUrlPathParams to support raw URL handling, preserving user encoding choices for snippet generation * fix(url): ensure URLs are prefixed with http:// if missing in interpolateUrlPathParams function * refactor(snippet-generator): streamline URL handling logic to improve snippet generation and ensure proper encoding based on settings * feat(url): add stripOrigin utility to simplify URL processing in snippet generation * test(snippet-generator): add test for double-encoding of pre-encoded URLs when encodeUrl is true * feat(encoding): implement URL encoding settings and add tests for encoding behavior * fix: address PR review comments (#7187) - Remove unnecessary no-op jest.mock for @usebruno/common/utils - Add length guard to prevent catastrophic replaceAll('/') on root-path URLs Co-Authored-By: Claude Opus 4.6 <[email protected]> * empty commit * fix(tests): update interpolateUrlPathParams tests to use correct parameter structure * empty commit --------- Co-authored-by: Claude Opus 4.6 <[email protected]> * feat: implement onboarding preferences and welcome modal for new users (#7319) * feat: implement onboarding preferences and welcome modal for new users * fixes * adding: defaultPreferences * fixes * fix: tests * fixes * fix: test * fix: test * fixes * fixes * Update copyright year to 2026 (#7302) * Update copyright year to 2026 * Update footer year to current year dynamically * fix: Postman import compatibility for multipart form-data file params (#7325) * fix: multipart form-data file param export/import for Postman * fix: Postman import compatibility for multipart form-data file params This commit fixes two issues that caused Postman to fail importing Bruno-exported collections with multipart form-data file parameters: 1. Changed `src` field format to match Postman's export format: - Single file: export as string (e.g., "/path/to/file") - Multiple files: export as array (e.g., ["/path/a", "/path/b"]) - Empty/null: export as null Previously, Bruno always exported `src` as an array, but Postman's importer expects a string for single files and fails to recognize the file type and path when given an array. 2. Added `protocolProfileBehavior.disableBodyPruning` for GET/HEAD/OPTIONS requests that have a body: By default, Postman discards request bodies for HTTP methods that typically don't have bodies (GET, HEAD, OPTIONS). Without this flag, importing a GET request with a form-data body would result in the body being silently dropped, making Postman unable to identify that the request has a formdata body at all. Both changes align Bruno's Postman export format with Postman's own export format, ensuring full import compatibility. --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> * fix(`oauth2`): prevent false callback matches on `root path URLs` (#7315) * fix(oauth2): prevent false callback matches on root path URLs and handle errors first Move error check before callback URL matching in onWindowRedirect so OAuth error responses are rejected immediately. Remove redundant error param check from matchesCallbackUrl and require a code param or hash fragment to match, preventing false positives on intermediate pages when the callback URL is a root path like https://hostname/. * fix(oauth2): clarify error handling comment Remove "on the callback URL" from comment since error checking now happens before callback URL matching. * feat: add `tokenType` support for OAuth2 (#7314) * feat: add tokenType support for OAuth2 * refactor: rename tokenType to source in OpenCollection OAuth2 mapping * refactor: rename tokenType to source in OAuth2 configuration * chore: bump @opencollection/types to ~0.8.0 * fix: correct OAuth2 token type label in token viewer * refactor: replace Dropdown with MenuDropdown in OAuth2 components Migrate all 12 dropdown instances across 5 OAuth2 auth components to use the MenuDropdown component, removing manual tippy ref management and forwardRef icon patterns in favor of a declarative items-based API. * feat: improve stack traces for script and test failures (#7181) * chore: update package-lock.json to include yaml dependency * feat: add script-aware stack traces and source context for script/test failures * chore: sync package-lock.json with yaml dependency in bruno-js * fix: handle null check in getErrorTypeName and align JSDoc style * refactor: derive script path from request.pathname and use SCRIPT_TYPES constant * fix: avoid showing source context for collection/folder script errors * feat: map collection/folder script errors to source file and line * fix: update error formatting and avoid undefined message * fix: resolve script block location in collection/folder yml files * refactor: use script wrapper utils and rename wrapper offsets * refactor: move script wrapper to utils, add wrapScriptInClosure fn * fix: resolved zoom ui remarks (#7326) * fix: resolved zoom ui remarks * fix: resolved comments * fix: resolved comments --------- Co-authored-by: shubh-bruno <[email protected]> * fix: ensure system proxy is initialized before use in network calls (#7264) getCachedSystemProxy now awaits the initialization promise, preventing a race condition where API calls made early in startup would bypass the system proxy. * fix: allow user to delete default bruno headers in pre-request (#7331) * fix: allow user to delete default bruno headers * fix: resolved comments --------- Co-authored-by: shubh-bruno <[email protected]> * feat: add functionality to create new HTTP requests from the welcome modal and collections section (#7350) * feat(sidebar): show "Add request" cta when collection or folder is empty (#7273) * feat(sidebar): show "Add request" cta when collection or folder is empty * fix: add connector lines and keyboard accessibility to empty-state CTA * fix: debounce empty collection state to prevent flicker Add 300ms delay before showing "Add request" button for empty collections. This fixes a race condition where isLoading becomes false before the items batch arrives from IPC, causing a brief flicker of the empty state. Made-with: Cursor --------- Co-authored-by: naman-bruno <[email protected]> * refactor: streamline onboarding process and preferences handling (#7349) * refactor: streamline onboarding process and preferences handling * fixes * fixes * feat(phase-1): allow user to customize keybindings (#7163) * feat(phase-1): allow user to customize keybindings * fix: necessary changes for customizied keybindings to work * fix: updated hotkeys provider * fix: test cases for edit keybindings in preferences * fix: removed old keyboard shortcuts test cases * fix: resolved coderabbit coments * fix: fixed move tabs test cases * feat: provided customized keybindings shorcut for codemirror instacnces * fix: handle closetabs/closeAllTabs in RequestTab/index.js for better consitency * fix: resolved comments * fix: resolved zoom issues * fix: revert codemirror instacnces * fix: handle codemirror instances shortcut in .Pass * feat: integrate shorcut keys with codemirror instacneces * fix: ui updates * fix: updated shortcuts * fix: test cases * chore: revert `alt-enter` keybind * chore: allow jest to replace esm spec in store * chore: lint whitespace fix --------- Co-authored-by: shubh-bruno <[email protected]> * fix: file extension for clone and rename request (#7278) * fix: file extension for clone and rename request * fix * feat: add collection creation flow in SaveTransientRequest modal (#7328) * feat: enhance API spec export with environment variables support (#7170) * feat: enhance API spec export with environment variables support - Updated `exportApiSpec` function to accept and process environment variables for multi-server exports. - Added logic to convert environment variables into a structured format for OpenAPI server entries. - Enhanced the `CreateApiSpec` component to include environments in the exported YAML content. - Introduced unit tests to validate the handling of server variables and their integration into the exported API specifications. * refactor: streamline API spec export logic and improve variable handling - Simplified variable extraction in `exportApiSpec` by directly assigning capture groups. - Updated URL interpolation to use request variables instead of global variables for better accuracy. - Enhanced handling of request body types by replacing early returns with breaks for clearer flow control. - Adjusted tests to ensure backward compatibility with OpenAPI specifications and server variable handling. * refactor: improve variable handling and URL processing in OpenAPI exporters - Streamlined server variable assignment in `exportApiSpec` to handle undefined values more gracefully. - Enhanced URL path extraction to ensure leading slashes are preserved in `getDefaultUrl` and `extractServerVars`. - Updated string replacement logic to use `replaceAll` for consistent variable substitution in URLs. * Fix persistence of additional parameters using open-collection format (#7296) Co-authored-by: TaylorJerry <[email protected]> Co-authored-by: MrcBoo <[email protected]> * feat: inline create collection and workspace editor (#7324) * feat: inline create collection and workspace editor * refactor: use inline collection creation from workspace overview * fix: improve inline collection creation UX from workspace overview * fix: update E2E tests for inline collection creation flow * fix: update default location test for inline collection creation flow * fix: derive inline workspace/collection names from filesystem * feat: inline workspace create form manage workspace * feat: prefill create modal with name * fix: minor code style fixes --------- Co-authored-by: naman-bruno <[email protected]> * chore: update coderabbit instructions to make sure the code is os agnostic (#7355) * refactor: comment out unused APIs (#7323) * refactor: comment out unused API hints in autocomplete.js * refactor: comment out unused API translations in postman and bruno translators Temporarily disable certain API translations due to UI update issues affecting their functionality. A note has been added to restore these translations once the UI fixes are implemented. * refactor: temporarily skip tests for collection variable translations due to UI update issues Commented out tests related to `setCollectionVar`, `deleteCollectionVar`, and related functionalities until the necessary UI updates are implemented. A note has been added to restore these tests once the fixes are live. * refactor: comment out variable deletion and retrieval methods due to UI sync issues * revert: ping.bru * refactor: update postman translation tests to enable previously skipped cases * Revert "Performance/file parse and mount (#6975)" (#7360) * Revert "Performance/file parse and mount (#6975)" This reverts commit f76f487211d3859edf2d14f0b11812811df3a758. * fix: import duplication * Revert "fix(batch-events): fix order of directory file and folder events (#7300)" This reverts commit bf4af42a25522d10f44e1fec17af63b3f0db0077. --------- Co-authored-by: Chirag Chandrashekhar <[email protected]> Co-authored-by: Sid <[email protected]> * fix: show '+ Add request' when only transient items exist (#7361) * fix: focus and text selection in workspace creation flow (#7363) * fix: workspace creation rename focus * refactor: remove duplicate focus/select timer from rename handler * feat/openapi sync (#7279) * feat: implement OpenAPI Sync * feat: enhance focus styles and error handling across components - Added focus-visible styles for buttons and tags in Swagger and Modal components to improve accessibility. - Updated ConnectSpecForm to ensure source URL is set only if the file path is valid. - Enhanced clipboard copy functionality in SpecInfoCard with error handling and success notifications. - Improved ExpandableEndpointRow to handle loading state more robustly. - Refined SyncReviewPage to ensure correct filtering of updated endpoints. - Updated file handling in OpenAPI Sync IPC to support both .yml and .yaml extensions. * fix: improve filename sanitization in OpenAPI Sync IPC - Updated filename sanitization logic to ensure proper handling of both `name` and `filename` properties, enhancing compatibility with various file formats. - Adjusted the logic to derive the base name from the filename when necessary, ensuring consistent output for generated files. * feat: enhance OpenAPI Sync tab with new overview and header components - Introduced OverviewSection to display summary of collection and spec status, including total endpoints, in-sync counts, and pending updates. - Added OpenAPISyncHeader for improved navigation and actions related to the OpenAPI spec. - Updated CollectionStatusSection to better handle and display collection drift information. - Refined styling for status banners and added new visual elements for better user experience. - Enhanced tooltip functionality in Help component for improved accessibility. * refactor: remove VisualDiffViewer components and add diff package - Deleted VisualDiffViewer components including VisualDiffMeta, VisualDiffDocs, VisualDiffVars, and others to streamline the codebase. - Introduced the 'diff' package in package-lock.json to enhance diff functionality. - Updated utility functions to improve diff status handling and maintainability. * feat: enhance OpenAPI Sync tab with sync status indicators and improved styling (#7371) - Added sync status logic to determine if the collection is in sync with the spec, displaying appropriate indicators in the UI. - Updated OpenAPISyncHeader to include linked collection information and sync status icons. - Refined styling in StyledWrapper for better layout and visual feedback on sync status. - Removed unused styles and components to streamline the codebase. * fix: enable `SSL session caching` and `HTTP agent reuse` for faster consecutive requests (#6987) * fix: enable SSL session caching for faster consecutive requests (#6929) * fix: enable SSL session caching for faster consecutive requests Previously, Bruno created a new HTTPS agent for every request, which meant SSL/TLS sessions couldn't be reused. This caused the full TLS handshake (~450ms) to run on every request, even to the same endpoint. Changes: - Add agent caching based on TLS configuration (certs, proxy, SSL options) - Reuse cached agents for requests with matching configuration - SSL sessions are now cached and reused, significantly reducing response time for consecutive requests to the same host The fix maintains backward compatibility: - Timeline logging moved to setup phase (before agent creation) - Proxy and SSL validation behavior unchanged - Added clearAgentCache() for testing and configuration changes Fixes #5574 Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: address review feedback for SSL session caching - Add passphrase to cache key to prevent incorrect agent reuse - Add MAX_AGENT_CACHE_SIZE (100) with LRU-style eviction - Use consistent node: prefix for crypto import Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: lohit <[email protected]> * feat(bruno-requests): add timeline agent for TLS event logging Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): add agent cache for SSL session reuse Co-Authored-By: Claude Opus 4.5 <[email protected]> * test(bruno-requests): add tests for agent cache Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): integrate agent cache into http-https-agents Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor(bruno-electron): use shared agent cache from bruno-requests Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-cli): use agent cache for SSL session reuse Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): add HTTP agent timeline support Add createTimelineHttpAgentClass for logging HTTP connection events including proxy usage, DNS lookups, and connection establishment. Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor(bruno-requests): extract shared agent caching logic Add getOrCreateAgentInternal helper to reduce code duplication between getOrCreateAgent and getOrCreateHttpAgent functions. Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): use HTTP agent cache for connection reuse Export getOrCreateHttpAgent and use it in http-https-agents for HTTP requests to enable connection pooling. Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(bruno-cli): improve HTTP agent handling and error logging - Use { keepAlive: true } instead of tlsOptions for HTTP agents - Add warning log for system proxy configuration errors - Fix brace style consistency Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(bruno-electron): improve HTTP agent handling - Use { keepAlive: true } instead of tlsOptions for HTTP agents - Fix brace style consistency - Add missing newline at EOF Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(bruno-requests): address code review findings for agent caching - Fix Buffer hashing bug: properly handle Buffer values in hashValue() - Add CA array support: new hashCaValue() handles string[] | Buffer[] - Fix timeline race condition: capture timeline reference in closure at createConnection start to isolate concurrent requests - Fix SSL verify message: check socket.authorized for accurate status - Fix HTTP/HTTPS agent logic: only set httpsAgent for HTTPS requests - Add tests for concurrent requests timeline isolation Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(bruno-requests): log when reusing cached agent - HTTPS agents: "Reusing cached agent (SSL session reuse enabled)" - HTTP agents: "Reusing cached agent (connection reuse enabled)" Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat(preferences): add cache.httpHttpsAgents.enabled preference * feat(agent-cache): add disableCache option to getOrCreateAgent * feat(proxy-util): respect httpHttpsAgents cache preference * refactor(agent-cache): use named props for getOrCreateAgent and getOrCreateHttpAgent * feat(ipc): add renderer:clear-http-https-agent-cache handler * feat(redux): add cache.httpHttpsAgents preferences to initial state * feat(ui): add Cache tab to Preferences * feat(cli): add --disable-http-https-agents-cache flag * refactor(cache): replace window.ipcRenderer calls with redux actions Add getCacheStats, purgeCache, and clearHttpHttpsAgentCache thunks to the app slice. Update the Cache preferences component to dispatch these actions instead of calling window.ipcRenderer directly. Also move handleSave and handleSaveRef above useFormik to fix declaration order — onSubmit closes over handleSaveRef, so the ref must be initialized before useFormik is called. * fix: tests * fix(cache): thread disableCache and hostname through all agent-creation paths - Forward disableHttpHttpsAgentsCache through getHttpHttpsAgents → createAgents so OAuth2 token requests and bru.sendRequest honour the CLI flag - Add hostname to agent cache keys (getAgentCacheKey, getHttpAgentCacheKey) for per-host TLS session reuse; extract hostname at every call site in run-single-request.js, proxy-util.js, and http-https-agents.ts - Add extractHostname helper in http-https-agents.ts to safely parse hostnames - Add test coverage for cert, key, pfx, passphrase, and hostname cache-key differentiation in agent-cache.spec.ts * refactor(cache): rename getOrCreateAgent to getOrCreateHttpsAgent * refactor: simplify UI labels, optimize agent timeline wrapping, silence proxy errors * fix: tests * fix(proxy): fix proxy agent construction and CA cert handling Three fixes: 1. Proxy agents (HttpsProxyAgent, HttpProxyAgent, SocksProxyAgent) expect (proxyUri, options) constructor signature, but the agent cache was packing proxyUri into options as a single argument. Fixed the non-timeline code path in getOrCreateAgentInternal. 2. HTTP requests through an HTTPS proxy need TLS options (ca certs) to validate the proxy's certificate. All getOrCreateHttpAgent call sites now pass TLS options when the proxy protocol is HTTPS. 3. Setting the `ca` option on any Node.js TLS connection replaces the default OpenSSL trust store entirely. CAs only in the OpenSSL default trust store (e.g. /etc/ssl/cert.pem) but not in tls.rootCertificates were lost. Fixed by converting `ca` to a secureContext via addCACert(), which appends custom CAs on top of the OpenSSL defaults instead of replacing them. Also simplified PatchedHttpsProxyAgent to selectively forward only the relevant TLS options (cert, key, pfx, passphrase, rejectUnauthorized, secureContext) to the target TLS upgrade instead of blindly merging all constructor options. * fix(tls): load client certs into secureContext to prevent silent drop Add Cache tab to Preferences UI * fix(proxy): align proxy auth check to use auth.disabled field consistently * refactor(cache): rename CLI flag to --cache-ssl-session and disable caching by default - Rename --disable-http-https-agents-cache to --cache-ssl-session (opt-in) - Rename disableHttpHttpsAgentsCache to cacheSslSession across CLI and bruno-requests - Default caching to disabled in both bruno-electron and bruno-cli - Add cacheSslSession to buildCertsAndProxyConfig for bru.sendRequest - Update Preferences UI labels to "Cache SSL Session" * refactor(cache): rename httpHttpsAgents to sslSession across preferences and UI * refactor(cache): remove unused getCacheStats and purgeCache IPC actions --------- Co-authored-by: karthik <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]> * Feat/opeanpi sync updates (#7374) * fix: update button colors and streamline props in OpenAPISyncTab and CollectionHeader - Changed button color from 'warning' to 'primary' in OpenAPISyncTab for better visual consistency. - Simplified prop usage for OpenAPISyncIcon in CollectionHeader by removing unnecessary function wrapper. * fix: update StatusBadge variant in OpenAPISyncHeader for improved styling - Changed StatusBadge in OpenAPISyncHeader to use 'outline' variant for better visual distinction of version information. * refactor: simplify OpenAPISyncTab and related components by removing unused state and styles (#7378) - Removed the `viewMode` state and associated logic from OpenAPISyncTab and useSyncFlow, streamlining the component's functionality. - Eliminated the `review-active` class from StyledWrapper, cleaning up the styling. - Updated Redux state management by removing `viewMode` from the tab UI state structure, reducing complexity. * chore: UI Polish for Zoom and Keybindings panel (#7376) * chore: ui polishing for zoom panel * fix: replace IconRefresh with IconReload in Zoom and Keybindings components * chore: resolved ui issues * test: check test cases * fix: adjust width properties in StyledWrapper component * fix: update keybindings UI layout and tooltip removal * chore: semantics --------- Co-authored-by: Sid <[email protected]> Co-authored-by: shubh-bruno <[email protected]> * fix: use Title Case for default "Untitled Collection" and "Untitled Workspace" (#7389) * fix: preserve existing process.env values in initializeShellEnv (#7390) * refactor: enhance OpenAPISyncTab functionality and clean up unused code (#7392) - Updated OpenAPISyncTab to utilize Redux state for active tab management, improving state consistency. - Removed unnecessary loading state checks from OverviewSection and SpecStatusSection for cleaner logic. - Streamlined prop usage in OverviewSection by eliminating the isLoading prop. - Cleaned up useOpenAPISync hook by removing unused state clearing logic on unmount. - Improved file handling in openapi-sync IPC by ensuring new files are created in the appropriate folder based on tags. * fix: update collection path handling to use path.join for consistency across components (#7394) * Fix: resolve default location missing path (#7391) * fix: refocus collection name input on error and resolve missing default location folder * revert: remove focus refocus logic from InlineCollectionCreator Reverts the setTimeout focus change that was causing test failures. Keeps the preferences.js fix for default location validation. Made-with: Cursor * fix: update default-collection-location test to use project path Use {{projectRoot}} template variable for defaultLocation so the path exists when the app validates it with fs.existsSync. Made-with: Cursor * fix: improve save test to use alternate path and verify persistence Made-with: Cursor --------- Co-authored-by: naman-bruno <[email protected]> * fix: allow edit keybinding shortcuts (#7404) Co-authored-by: shubh-bruno <[email protected]> * fix: app crash error (Rendered fewer hooks than expected) (#7407) * fix: app crash error (Rendered fewer hooks than expected) * empty commit * enhance OpenAPI sync with validation, enum support, and bug fixes (#7408) * Enhance OpenAPISyncTab functionality with error handling and UI improvements - Updated ConnectSpecForm to include error handling for invalid OpenAPI specifications when uploading files. - Added a sync info notice in CollectionStatusSection to inform users about tracked changes. - Improved styling in StyledWrapper for better visual feedback and layout consistency. - Adjusted button colors and properties in ConfirmSyncModal and ConnectionSettingsModal for better UX. - Refactored useOpenAPISync hook to validate URLs before syncing, ensuring only valid OpenAPI specs are processed. - Enhanced parameter handling in openapi-to-bruno.js to support enum and default values more effectively. * Refactor OpenAPISyncTab components for improved URL validation and error handling - Updated ConnectSpecForm to streamline file upload error handling for OpenAPI specifications. - Enhanced OpenAPISyncHeader to utilize isHttpUrl for better URL validation. - Refactored useOpenAPISync hook to replace isValidUrl with isHttpUrl for consistency in URL checks. - Improved file parsing logic in file-reader.js to handle case-insensitive JSON file extensions. - Added isHttpUrl utility function to validate HTTP/HTTPS URLs effectively. * Enhance file parsing logic in file-reader.js to improve error handling for JSON and YAML files - Updated parseFileAsJsonOrYaml function to handle case-insensitive JSON file extensions more robustly. - Added error handling to ensure the document root is an object and not an array, improving data validation. * Update StatusBadge component to include new 'xs' size preset and adjust documentation accordingly - Added 'xs' size preset with specific font size and padding for minimal use cases. - Updated documentation to reflect the new size options available for the StatusBadge component. * feat(request-pane): restore body tab scroll position on tab switch (#7250) * feat(request-pane): restore body tab scroll position on tab switch When editing large request bodies (JSON/XML/text/sparql), switching to another tab (params, headers, auth, etc.) and back would reset the CodeMirror editor scroll position to the top. Fix by persisting the scroll position to Redux on editor unmount (via CodeEditor's onScroll prop) and restoring it on mount (via initialScroll), mirroring the existing scroll restoration pattern in QueryResultPreview. * test: add playwright tests for body scroll restoration --------- Co-authored-by: naman-bruno <[email protected]>…
* feat(phase-1): allow user to customize keybindings * fix: necessary changes for customizied keybindings to work * fix: updated hotkeys provider * fix: test cases for edit keybindings in preferences * fix: removed old keyboard shortcuts test cases * fix: resolved coderabbit coments * fix: fixed move tabs test cases * feat: provided customized keybindings shorcut for codemirror instacnces * fix: handle closetabs/closeAllTabs in RequestTab/index.js for better consitency * fix: resolved comments * fix: resolved zoom issues * fix: revert codemirror instacnces * fix: handle codemirror instances shortcut in .Pass * feat: integrate shorcut keys with codemirror instacneces * fix: ui updates * fix: updated shortcuts * fix: test cases * chore: revert `alt-enter` keybind * chore: allow jest to replace esm spec in store * chore: lint whitespace fix --------- Co-authored-by: shubh-bruno <[email protected]>
…runo#7457) * Revert "feat(phase-1): allow user to customize keybindings (usebruno#7163)" This reverts commit 8964af9. * Revert "chore: UI Polish for Zoom and Keybindings panel (usebruno#7376)" This reverts commit 474e677.
Description
JIRA
In this PR is phase 1 of allowing user to customize keybindings in preferences tab
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
New Features
Style
Tests
Chores