Repository navigation
feat: show scripted requests in timeline - #8047
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 scripted-request entry building and recording with per-call scope, emits/stores scripted-request and oauth2-debug events for collection and runner runs, classifies/filters timeline entries, and rewrites Timeline/RunnerTimeline UI and TimelineItem/subcomponents with tests and Playwright coverage. ChangesScripted Request Timeline System & Timeline UI
Estimated code review effort 🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 13
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/bruno-app/src/components/ResponsePane/Timeline/entryMeta.js`:
- Around line 17-21: getBadge currently determines badge only from
source/isOauth2 causing mismatch with getEntryKind (which considers phase like
"tests" and "post-response"); change getBadge to derive the badge from the same
mapping as getEntryKind (e.g., call getEntryKind(entry) or reuse its logic) so
that entries with phase "tests" or "post-response" map to ENTRY_KINDS.post and
the badge matches the filter kind; keep handling for isOauth2 to return
ENTRY_KINDS.oauth as before.
In `@packages/bruno-app/src/components/ResponsePane/Timeline/index.js`:
- Around line 54-68: When the entries/counts change the component should clamp
activeFilter back to 'all' if the currently selected activeFilter is no longer
available; add an effect that watches entries (or counts/visibleChips) and calls
setActiveFilter('all') whenever showFilterBar is false or visibleChips does not
include the current activeFilter (use activeFilter, setActiveFilter,
visibleChips, showFilterBar, entries/counts to locate the logic). Ensure the
effect runs after buildTimelineEntries/countByKind updates so the UI never
remains filtered to an unavailable chip.
- Around line 130-144: buildTimelineEntries() can emit oauth entries without
debugInfo but the render branch only handles entries with entry._oauth2Child,
causing those oauth parents to disappear; update the Timeline rendering in
ResponsePane/Timeline/index.js to also render the parent oauth entry when
entry.type === 'oauth2' and entry._oauth2Child is missing by rendering a
TimelineItem with the parent entry's timestamp/request/response (or otherwise
display a single-row fallback), referencing the same props used for the child
(timestamp, request, response, item, collection, source="oauth2.0",
isOauth2=true); alternatively, remove returning orphan oauth entries from
buildTimelineEntries() so only entries with _oauth2Child reach this component.
In
`@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Body/index.js`:
- Around line 11-16: Replace the non-semantic div that toggles Body with a real
button: change the wrapping element that currently has className "tl-block-h"
and onClick={() => setIsOpen(!isOpen)} to a <button type="button"> while
preserving className and the existing onClick handler (and the chevron icons
IconChevronDown/IconChevronRight driven by isOpen); add aria-expanded={isOpen}
and a data-testid attribute (e.g., data-testid="response-body-toggle") to the
button so keyboard users can operate it and Playwright can target it.
In
`@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Headers/index.js`:
- Around line 19-25: Replace the clickable div header with a semantic button:
change the element that currently uses className "tl-block-h" and onClick={() =>
setIsOpen(!isOpen)} to a <button> that retains the same classes, move the
onClick handler to that button, add aria-expanded={isOpen} so screen readers
know the state, and add a data-testid (e.g. data-testid="headers-toggle") for
Playwright; ensure the chevron icon rendering logic using isOpen,
IconChevronDown and IconChevronRight and the count display remain unchanged and
that any styles targeting ".tl-block-h" still apply to the button.
In
`@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.js`:
- Around line 130-149: The clickable row currently implemented as the div with
className "tl-row" (which uses onClick={toggleExpand}) must be made
keyboard-accessible: replace that div with a real <button> or, if keeping a
non-button element, add role="button", tabIndex={0}, an onKeyDown handler that
triggers toggleExpand on Enter and Space, and set aria-expanded={isExpanded}
(and an accessible label/aria-label if needed) so screen readers and keyboard
users can toggle the expand/collapse using the keyboard; update the element
rendering around the tl-row (and ensure any nested interactive children remain
operable).
In
`@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Response/index.js`:
- Around line 33-40: The visibility check uses truthiness for code so a status
code of 0 is treated as absent; update the hasAny expression in the Response
component to treat 0 as valid by checking code explicitly against null/undefined
(e.g., code !== null && code !== undefined) instead of using code alone, and
keep the existing checks for statusText, duration, and sizeLabel so the early
return only happens when all metadata are truly absent.
In
`@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/StyledWrapper.js`:
- Around line 24-27: The styles in StyledWrapper.js use hardcoded RGBA values
(e.g., the background on .tl-row and .tl-row.is-expanded and other occurrences
around lines referenced) which should be replaced with theme-driven tokens or
theme alpha helpers; update the background declarations in the .tl-row,
.tl-row.is-expanded and the other affected selectors (around the 81, 86-99, and
265 occurrences) to pull colors from props.theme (e.g., a semantic token like
theme.colors.bg2 or a theme-provided alpha function) instead of literal
"rgba(...)" strings so all hover/badge/expanded backgrounds are derived from the
theme. Ensure you reference and use the existing styled-components theme prop in
StyledWrapper.js and replace each literal RGBA with the appropriate theme token
or theme alpha helper.
In `@packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js`:
- Around line 3186-3199: The runner branch handling type === 'scripted-request'
omits requestUid, causing scripted-request entries to be indistinguishable
across iterations; update the destructuring of action.payload to include
requestUid (e.g., const { phase, source, scope, timestamp, data, requestUid } =
action.payload) and add requestUid to the object pushed onto collection.timeline
(use null/default if absent) so the runner-side scripted-request entries match
the item-level timeline structure.
In `@packages/bruno-electron/src/ipc/network/index.js`:
- Around line 1454-1467: The runner emits only
scriptResult.scriptedRequestEntries via emitRunnerScriptedRequestEvents, so
calls to bru.runRequest invoked inside runner pre-request/post-response/tests
aren't recorded; modify emitRunnerScriptedRequestEvents (and analogous spots
around lines referenced) to also capture and replay any entries produced by
callerBru._recordScriptedRequest or direct bru.runRequest calls (e.g., by
merging scriptResult.scriptedRequestEntries with any recorded entries on the
callerBru instance or exposing a hook on runRequestByItemPathname to forward
recorded entries), and then send those merged entries to mainWindow.webContents
with the same payload shape so runner timeline shows bru.runRequest events.
Ensure you reference emitRunnerScriptedRequestEvents, runRequestByItemPathname,
callerBru._recordScriptedRequest and bru.runRequest when locating and updating
the code.
In `@packages/bruno-electron/src/utils/collection.js`:
- Around line 164-169: The scope setter __bruSetScope currently gets injected
inside the IIFE, which breaks 'use strict' directive prologues; move the
scopeSetter (constructed from scopeInfo) so it is emitted immediately before the
IIFE instead of inside it. Concretely, keep using the existing scopeSetter and
script variables but build the returned string so that scopeSetter appears on
the lines immediately preceding the "await (async () => { ... })();" expression
(not inside its function body), preserving the same newline counts for
stack-trace mapping and ensuring the IIFE body contains only the user script.
In `@packages/bruno-js/src/bru.js`:
- Around line 64-66: The onComplete callback for createSendRequest reads the
mutable this._currentScope when the async request settles, causing wrong
attribution; instead capture a snapshot of the current scope when sendRequest is
invoked and carry that snapshot through to the recorded entry. Modify the
sendRequest creation/wrapper (the createSendRequest call or this.sendRequest
assignment) so that it captures const scopeSnapshot = this._currentScope (or
equivalent) at call time and ensures the onComplete handler receives that
snapshot (e.g., include scopeSnapshot on the entry passed to
this._recordScriptedRequest) rather than reading this._currentScope inside
onComplete; update references to onComplete, this._recordScriptedRequest and
createSendRequest accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2fa43f3b-0f53-4e31-9bbb-5cd759f1c30e
📒 Files selected for processing (24)
packages/bruno-app/src/components/ResponsePane/RunnerTimeline/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/GrpcTimelineItem/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Body/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Headers/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Status/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Network/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Request/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Response/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/buildEntries.jspackages/bruno-app/src/components/ResponsePane/Timeline/entryMeta.jspackages/bruno-app/src/components/ResponsePane/Timeline/index.jspackages/bruno-app/src/providers/ReduxStore/slices/collections/index.jspackages/bruno-electron/src/ipc/network/index.jspackages/bruno-electron/src/utils/collection.jspackages/bruno-js/src/bru.jspackages/bruno-js/src/runtime/script-runtime.jspackages/bruno-js/src/runtime/scripted-entries.jspackages/bruno-js/src/runtime/test-runtime.jspackages/bruno-js/src/sandbox/quickjs/shims/bru.jspackages/bruno-requests/src/scripting/index.tspackages/bruno-requests/src/scripting/send-request.ts
There was a problem hiding this comment.
♻️ Duplicate comments (2)
packages/bruno-app/src/components/ResponsePane/Timeline/entryMeta.js (1)
17-21:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winBadge mapping is still out of sync with timeline kind for tests-phase entries.
getBadge()ignoresphase, so scripted entries withphase: 'tests'can still show the pre-request badge while being counted as post-response elsewhere. Please derive badge kind from the same kind logic used bygetEntryKind().🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/components/ResponsePane/Timeline/entryMeta.js` around lines 17 - 21, getBadge currently ignores phase and can mislabel scripted "tests" entries; change getBadge to derive its badge kind using the same logic as getEntryKind (either by accepting the full entry object or by calling getEntryKind(entry) inside getBadge) and then map the resulting entry kind to the appropriate ENTRY_KINDS value; update getBadge's signature/usages if needed so it receives phase/source/isOauth2 (or the whole entry) and ensure ENTRY_KINDS mapping for oauth/main/post/pre follows getEntryKind so tests-phase entries render the post badge consistently.packages/bruno-js/src/bru.js (1)
63-65:⚠️ Potential issue | 🟠 Major | ⚡ Quick winScope attribution can still race for async scripted requests.
_recordScriptedRequest()always readsthis._currentScopeat completion time, so non-awaitedsendRequest()calls can be attributed to a later segment’s scope. Preserve call-time scope (fromentry.scopeif provided) and avoid overwriting it with mutable state.Suggested minimal fix
_recordScriptedRequest(entry) { + const scopeSnapshot = entry.scope ?? (this._currentScope ? { ...this._currentScope } : null); this.scriptedRequestEntries.push({ ...entry, - scope: this._currentScope ? { ...this._currentScope } : null + scope: scopeSnapshot }); }Also applies to: 164-168
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-js/src/bru.js` around lines 63 - 65, The race occurs because _recordScriptedRequest reads this._currentScope at completion time; fix by preserving the call-time scope: when creating the callback for createSendRequest (the sendRequest assignment) capture and pass the scope from the request entry (use entry.scope if present, otherwise fallback to this._currentScope) into the object sent to _recordScriptedRequest, and update _recordScriptedRequest to prefer the provided entry.scope and not overwrite it with this._currentScope; apply the same change pattern to the other similar callback site referenced around the sendRequest alternative (the block at lines 164-168) so async, non-awaited sendRequest calls are attributed to the scope captured at call-time.
🧹 Nitpick comments (3)
tests/utils/page/actions.ts (1)
1236-1251: ⚡ Quick winReplace fixed 400ms sleeps with event-driven save confirmation.
Both helpers use
page.waitForTimeout(400)right after save. That makes these flows timing-sensitive in CI. Prefer waiting for a deterministic UI signal (e.g., save toast, dirty-state cleared, or save action disabled) instead.As per coding guidelines: “Try to reduce usage of
page.waitForTimeout();in code unless absolutely necessary and the locator cannot be found using existingexpect()playwright calls.”Also applies to: 1261-1278
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/utils/page/actions.ts` around lines 1236 - 1251, The test uses a fixed 400ms sleep after simulating the save in addFolderScript (and the similar helper at lines 1261-1278), which causes flaky CI; instead, after pressing the save shortcut in addFolderScript and the other helper, wait for a deterministic UI signal: e.g., await a save toast locator (locators.toasts.save.success), wait for the editor dirty-state to clear (a CSS class removed on the editor element like `folder-${phase}-script-editor`), or wait for the save action/button to become disabled via locators.paneTabs.tabTrigger or a save button locator; replace page.waitForTimeout(400) with one of those expect/waitFor calls to confirm the save completed.packages/bruno-electron/src/ipc/network/index.js (1)
1369-1408: 💤 Low valueConsider extracting duplicated scripted-entry recording logic.
The
runRequestByItemPathnamecallback in the runner path (lines 1360-1412) is nearly identical to the standalone path (lines 745-797). Both mint timestamps, callrunRequest, and invokecallerBru._recordScriptedRequestwithbuildScriptedEntry. Extracting a shared helper would reduce drift risk.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-electron/src/ipc/network/index.js` around lines 1369 - 1408, Extract the duplicated scripted-entry recording logic into a shared helper function (e.g., recordScriptedRequestEntry) and replace the duplicated blocks in both the runRequestByItemPathname callback and the standalone path with calls to that helper; the helper should accept parameters (res, err, _item/collection context, startedAt, completedAt, callerBru) and internally build the entry via buildScriptedEntry, compute sent/res/response/error fields the same way the current blocks do, and invoke callerBru._recordScriptedRequest, preserving the existing call site behavior around resolve/reject after the helper returns.packages/bruno-app/src/components/ResponsePane/Timeline/index.js (1)
65-73: 💤 Low valueMinor:
visibleChipsrecalculates every render, triggering effect comparisons.
visibleChipsis a new array reference on each render, causing theuseEffectdependency check to run repeatedly. Since the effect usesArray.some()internally, it still works correctly, but memoizingvisibleChipswould be slightly cleaner.- const visibleChips = FILTER_CHIPS.filter((chip) => chip.id === 'all' || counts[chip.id] > 0); + const visibleChips = useMemo( + () => FILTER_CHIPS.filter((chip) => chip.id === 'all' || counts[chip.id] > 0), + [counts] + );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/components/ResponsePane/Timeline/index.js` around lines 65 - 73, visibleChips is recreated each render which forces the useEffect dependency check to run; wrap the FILTER_CHIPS.filter(...) call in useMemo to memoize visibleChips and depend only on the counts used for visibility (e.g. useMemo(() => FILTER_CHIPS.filter(chip => chip.id === 'all' || counts[chip.id] > 0), [counts])). Update references to visibleChips and keep the existing useEffect (still depending on activeFilter and visibleChips) so the effect only runs when visibility actually changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@packages/bruno-app/src/components/ResponsePane/Timeline/entryMeta.js`:
- Around line 17-21: getBadge currently ignores phase and can mislabel scripted
"tests" entries; change getBadge to derive its badge kind using the same logic
as getEntryKind (either by accepting the full entry object or by calling
getEntryKind(entry) inside getBadge) and then map the resulting entry kind to
the appropriate ENTRY_KINDS value; update getBadge's signature/usages if needed
so it receives phase/source/isOauth2 (or the whole entry) and ensure ENTRY_KINDS
mapping for oauth/main/post/pre follows getEntryKind so tests-phase entries
render the post badge consistently.
In `@packages/bruno-js/src/bru.js`:
- Around line 63-65: The race occurs because _recordScriptedRequest reads
this._currentScope at completion time; fix by preserving the call-time scope:
when creating the callback for createSendRequest (the sendRequest assignment)
capture and pass the scope from the request entry (use entry.scope if present,
otherwise fallback to this._currentScope) into the object sent to
_recordScriptedRequest, and update _recordScriptedRequest to prefer the provided
entry.scope and not overwrite it with this._currentScope; apply the same change
pattern to the other similar callback site referenced around the sendRequest
alternative (the block at lines 164-168) so async, non-awaited sendRequest calls
are attributed to the scope captured at call-time.
---
Nitpick comments:
In `@packages/bruno-app/src/components/ResponsePane/Timeline/index.js`:
- Around line 65-73: visibleChips is recreated each render which forces the
useEffect dependency check to run; wrap the FILTER_CHIPS.filter(...) call in
useMemo to memoize visibleChips and depend only on the counts used for
visibility (e.g. useMemo(() => FILTER_CHIPS.filter(chip => chip.id === 'all' ||
counts[chip.id] > 0), [counts])). Update references to visibleChips and keep the
existing useEffect (still depending on activeFilter and visibleChips) so the
effect only runs when visibility actually changes.
In `@packages/bruno-electron/src/ipc/network/index.js`:
- Around line 1369-1408: Extract the duplicated scripted-entry recording logic
into a shared helper function (e.g., recordScriptedRequestEntry) and replace the
duplicated blocks in both the runRequestByItemPathname callback and the
standalone path with calls to that helper; the helper should accept parameters
(res, err, _item/collection context, startedAt, completedAt, callerBru) and
internally build the entry via buildScriptedEntry, compute
sent/res/response/error fields the same way the current blocks do, and invoke
callerBru._recordScriptedRequest, preserving the existing call site behavior
around resolve/reject after the helper returns.
In `@tests/utils/page/actions.ts`:
- Around line 1236-1251: The test uses a fixed 400ms sleep after simulating the
save in addFolderScript (and the similar helper at lines 1261-1278), which
causes flaky CI; instead, after pressing the save shortcut in addFolderScript
and the other helper, wait for a deterministic UI signal: e.g., await a save
toast locator (locators.toasts.save.success), wait for the editor dirty-state to
clear (a CSS class removed on the editor element like
`folder-${phase}-script-editor`), or wait for the save action/button to become
disabled via locators.paneTabs.tabTrigger or a save button locator; replace
page.waitForTimeout(400) with one of those expect/waitFor calls to confirm the
save completed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 35d2ecd3-4d1d-4c45-9c58-bfaba145c7f6
📒 Files selected for processing (22)
packages/bruno-app/src/components/ResponsePane/RunnerTimeline/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/buildEntries.jspackages/bruno-app/src/components/ResponsePane/Timeline/entryMeta.jspackages/bruno-app/src/components/ResponsePane/Timeline/index.jspackages/bruno-app/src/providers/ReduxStore/slices/collections/index.jspackages/bruno-app/src/providers/ReduxStore/slices/collections/timeline-routing.spec.jspackages/bruno-electron/src/ipc/network/index.jspackages/bruno-js/src/bru.jspackages/bruno-js/src/runtime/scripted-entries.jspackages/bruno-js/src/sandbox/quickjs/shims/bru.jspackages/bruno-js/tests/bru-scripted-entries.spec.jspackages/bruno-js/tests/script-runtime-scripted-entries.spec.jspackages/bruno-js/tests/scripted-entries.spec.jspackages/bruno-requests/src/scripting/scripted-entry.spec.tspackages/bruno-requests/src/scripting/send-request.spec.tspackages/bruno-requests/src/scripting/send-request.tstests/request/timeline/timeline-scripted-requests.spec.tstests/request/timeline/timeline-url-update.spec.tstests/utils/page/actions.ts
💤 Files with no reviewable changes (1)
- packages/bruno-app/src/components/ResponsePane/Timeline/StyledWrapper.js
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.js (1)
59-61:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMissing
activeTabdependency inuseEffect.The effect references
activeTabbut it's not in the dependency array. This causes stale closure issues whenactiveTabchanges while collapsed.useEffect(() => { if (isExpanded) setVisitedTabs({ [activeTab]: true }); - }, [isExpanded]); + }, [isExpanded, activeTab]);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.js` around lines 59 - 61, The useEffect that sets visited tabs references activeTab but doesn't include it in the dependency array, causing stale closures; update the effect's dependency array to include activeTab (e.g., useEffect(() => { if (isExpanded) setVisitedTabs({ [activeTab]: true }); }, [isExpanded, activeTab])) so the effect runs when activeTab changes while collapsed; keep the existing isExpanded and setVisitedTabs usage (or use a functional update on setVisitedTabs if you want to merge with prior state).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/auth/oauth1/oauth1-runner.spec.ts`:
- Around line 101-107: The test currently asserts OAuth params are not in the
URL and are present in the Body (using detail.locator('.tl-header-url-text') and
the body locator stored in body), but it doesn't assert headers don't contain
them; add a negative assertion that the Headers block does not contain
'oauth_consumer_key' as well. Locate the Headers block similarly to how body is
found (use detail.locator('.tl-block').filter({ has: page.locator('.tl-block-h',
{ hasText: 'Headers' }) })) and add await
expect(headers).not.toContainText('oauth_consumer_key') so the test verifies
URL, Body, and Headers placement.
---
Outside diff comments:
In
`@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.js`:
- Around line 59-61: The useEffect that sets visited tabs references activeTab
but doesn't include it in the dependency array, causing stale closures; update
the effect's dependency array to include activeTab (e.g., useEffect(() => { if
(isExpanded) setVisitedTabs({ [activeTab]: true }); }, [isExpanded, activeTab]))
so the effect runs when activeTab changes while collapsed; keep the existing
isExpanded and setVisitedTabs usage (or use a functional update on
setVisitedTabs if you want to merge with prior state).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 426be926-d35d-4680-8da2-36db18b7ce27
📒 Files selected for processing (11)
packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Body/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Headers/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Status/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Response/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/index.jspackages/bruno-electron/src/ipc/network/index.jspackages/bruno-js/src/bru.jspackages/bruno-js/tests/bru-scripted-entries.spec.jstests/auth/oauth1/oauth1-runner.spec.ts
There was a problem hiding this comment.
🧹 Nitpick comments (4)
tests/utils/page/actions.ts (1)
1256-1258: ⚡ Quick winConsider waiting for a visible confirmation instead of fixed timeout.
Per test guidelines,
waitForTimeoutshould be minimized. After the save shortcut, you could wait for a toast or verify the editor state changed.await page.keyboard.press(saveShortcut); - await page.waitForTimeout(400); + // Wait for save confirmation toast if one appears, or use a short poll + await expect(page.getByText(/saved/i)).toBeVisible({ timeout: 2000 }).catch(() => {});Same applies to
addCollectionScriptat line 1285.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/utils/page/actions.ts` around lines 1256 - 1258, Replace the fixed sleep after simulating the save shortcut with an explicit wait for a visible confirmation or editor-state change: instead of calling page.waitForTimeout(400) after page.keyboard.press(saveShortcut) in the save flow (and similarly in addCollectionScript), wait for a toast or success element with page.waitForSelector or wait for the document/editor model to reflect the saved state with page.waitForFunction; locate the save action by the saveShortcut variable and the code that calls page.keyboard.press and update those spots to await a concrete selector or state change rather than a fixed timeout.packages/bruno-electron/src/ipc/network/index.js (1)
754-789: ⚖️ Poor tradeoffDuplicated WS/gRPC skip logic between standalone and runner paths.
Lines 754-789 and 1406-1441 contain nearly identical skip handling for WebSocket/gRPC requests. Consider extracting to a shared helper:
const buildSkippedWsGrpcEntry = (item, callerBru) => { const protocolLabel = item.type === 'ws-request' ? 'WebSocket' : 'gRPC'; const startedAt = Date.now(); callerBru?._recordScriptedRequest?.({ source: 'runRequest', request: { method: (item.request?.method || 'GET').toString().toUpperCase(), url: item.request?.url, headers: {}, data: null }, response: { statusCode: null, statusText: 'Skipped', headers: {}, data: null, dataBuffer: '', size: 0, duration: 0 }, error: null, startedAt, completedAt: startedAt }); return { status: 'skipped', statusText: `bru.runRequest does not support ${protocolLabel} requests`, headers: {}, data: null, duration: 0, size: 0 }; };This reduces maintenance burden if the skip behavior needs updates.
Also applies to: 1406-1441
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-electron/src/ipc/network/index.js` around lines 754 - 789, Extract the duplicated WS/gRPC skip handling into a shared helper (suggested name buildSkippedWsGrpcEntry) and replace the two duplicated blocks with calls to it; the helper should accept the request item and callerBru, compute protocolLabel and startedAt, call callerBru?._recordScriptedRequest? with the same request/response/error/startedAt/completedAt structure, and return the same skip result object used by the callers so both the standalone path and runner path (the blocks around the current duplicated code) call buildSkippedWsGrpcEntry(item, callerBru) and resolve/return its result.packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Status/index.spec.js (1)
27-27: 💤 Low valuePrefer RTL queries over direct DOM access.
document.querySelectorworks but bypasses RTL's async-aware utilities. Consider usingscreen.getByRoleor adding adata-testidand usingscreen.getByTestId.-const getPill = () => document.querySelector('.timeline-status'); +const getPill = () => screen.getByRole('status', { hidden: true }) ?? document.querySelector('.timeline-status');That said, since
.timeline-statusis a simple class selector and tests pass, this is low priority.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Status/index.spec.js` at line 27, The test helper getPill currently uses document.querySelector('.timeline-status'), which bypasses RTL's async-aware utilities; update getPill to use Testing Library queries (e.g., import { screen } from '`@testing-library/react`' and replace document.querySelector with screen.getByRole(...) if the status has an accessible role or add a data-testid on the status element and use screen.getByTestId('timeline-status')), and if the element may render asynchronously use the async findBy... variant; update any tests that call getPill accordingly so they rely on RTL queries instead of direct DOM access.packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.js (1)
59-61: 💤 Low valueMissing
activeTabin dependency array.The effect reads
activeTabbut only listsisExpandedin deps. ESLint's exhaustive-deps rule would flag this. Since the intent is to reset on expansion toggle only, consider capturingactiveTabat toggle time or adding a comment suppressing the lint warning.useEffect(() => { if (isExpanded) setVisitedTabs({ [activeTab]: true }); + // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally reset only on expand toggle }, [isExpanded]);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.js` around lines 59 - 61, The useEffect in the TimelineItem component reads activeTab but only lists isExpanded in its dependency array, which triggers exhaustive-deps; fix by either adding activeTab to the deps ([isExpanded, activeTab]) or, if the intent is to snapshot activeTab only when expansion toggles, capture the current activeTab at toggle time (e.g., in the handler that sets isExpanded) and call setVisitedTabs({ [capturedActiveTab]: true }) there; alternatively you can add an inline eslint-disable-next-line comment above the effect to silence the rule if you intentionally want to ignore activeTab—update the code around useEffect, setVisitedTabs, isExpanded, and activeTab accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Status/index.spec.js`:
- Line 27: The test helper getPill currently uses
document.querySelector('.timeline-status'), which bypasses RTL's async-aware
utilities; update getPill to use Testing Library queries (e.g., import { screen
} from '`@testing-library/react`' and replace document.querySelector with
screen.getByRole(...) if the status has an accessible role or add a data-testid
on the status element and use screen.getByTestId('timeline-status')), and if the
element may render asynchronously use the async findBy... variant; update any
tests that call getPill accordingly so they rely on RTL queries instead of
direct DOM access.
In
`@packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.js`:
- Around line 59-61: The useEffect in the TimelineItem component reads activeTab
but only lists isExpanded in its dependency array, which triggers
exhaustive-deps; fix by either adding activeTab to the deps ([isExpanded,
activeTab]) or, if the intent is to snapshot activeTab only when expansion
toggles, capture the current activeTab at toggle time (e.g., in the handler that
sets isExpanded) and call setVisitedTabs({ [capturedActiveTab]: true }) there;
alternatively you can add an inline eslint-disable-next-line comment above the
effect to silence the rule if you intentionally want to ignore activeTab—update
the code around useEffect, setVisitedTabs, isExpanded, and activeTab
accordingly.
In `@packages/bruno-electron/src/ipc/network/index.js`:
- Around line 754-789: Extract the duplicated WS/gRPC skip handling into a
shared helper (suggested name buildSkippedWsGrpcEntry) and replace the two
duplicated blocks with calls to it; the helper should accept the request item
and callerBru, compute protocolLabel and startedAt, call
callerBru?._recordScriptedRequest? with the same
request/response/error/startedAt/completedAt structure, and return the same skip
result object used by the callers so both the standalone path and runner path
(the blocks around the current duplicated code) call
buildSkippedWsGrpcEntry(item, callerBru) and resolve/return its result.
In `@tests/utils/page/actions.ts`:
- Around line 1256-1258: Replace the fixed sleep after simulating the save
shortcut with an explicit wait for a visible confirmation or editor-state
change: instead of calling page.waitForTimeout(400) after
page.keyboard.press(saveShortcut) in the save flow (and similarly in
addCollectionScript), wait for a toast or success element with
page.waitForSelector or wait for the document/editor model to reflect the saved
state with page.waitForFunction; locate the save action by the saveShortcut
variable and the code that calls page.keyboard.press and update those spots to
await a concrete selector or state change rather than a fixed timeout.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9bb05aa8-8122-4b9e-a262-faa8c541a800
📒 Files selected for processing (6)
packages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Status/index.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/Common/Status/index.spec.jspackages/bruno-app/src/components/ResponsePane/Timeline/TimelineItem/index.jspackages/bruno-electron/src/ipc/network/index.jstests/request/timeline/timeline-runrequest-skip.spec.tstests/utils/page/actions.ts
✅ Files skipped from review due to trivial changes (1)
- tests/request/timeline/timeline-runrequest-skip.spec.ts
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/bruno-electron/src/ipc/network/index.js (1)
1455-1467:⚠️ Potential issue | 🟠 Major | ⚡ Quick winForward
callerBruand add fallback request fields in runner nestedrunRequest.Line 1455 drops
callerBruwhen invoking backgroundrunRequest, so nested scripted entries from inner scripts are not bubbled in runner mode. Also, Lines 1465-1466 can emit empty method/URL on network-error paths whenrequestSentis absent.Suggested fix
- res = await runRequest({ item: _item, collection, envVars, processEnvVars, runtimeVariables, runInBackground: true }); + res = await runRequest({ item: _item, collection, envVars, processEnvVars, runtimeVariables, runInBackground: true, callerBru }); ... const completedAt = Date.now(); const sent = res?.requestSent || {}; + const fallbackRequest = _item.request || {}; callerBru?._recordScriptedRequest?.({ source: 'runRequest', ...buildScriptedEntry({ request: { - method: sent.method, - url: sent.url || res?.url, + method: sent.method || fallbackRequest.method, + url: sent.url || res?.url || fallbackRequest.url, headers: sent.headers, data: sent.data },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-electron/src/ipc/network/index.js` around lines 1455 - 1467, When calling runRequest in the background, forward the callerBru through the options and ensure request fields have fallbacks so nested scripted entries aren't empty: pass callerBru into the runRequest call (preserving the existing runInBackground: true) and when building the scripted entry use fallbacks like sent.method || res?.method || 'GET' and sent.url || res?.url || '' (and similar for headers/body using sent.* || res.*) inside the buildScriptedEntry call so network-error paths still produce meaningful request values; update the invocation and the buildScriptedEntry request population accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@packages/bruno-electron/src/ipc/network/index.js`:
- Around line 1455-1467: When calling runRequest in the background, forward the
callerBru through the options and ensure request fields have fallbacks so nested
scripted entries aren't empty: pass callerBru into the runRequest call
(preserving the existing runInBackground: true) and when building the scripted
entry use fallbacks like sent.method || res?.method || 'GET' and sent.url ||
res?.url || '' (and similar for headers/body using sent.* || res.*) inside the
buildScriptedEntry call so network-error paths still produce meaningful request
values; update the invocation and the buildScriptedEntry request population
accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9813d4d8-c986-4960-b95b-05de3b464031
📒 Files selected for processing (4)
packages/bruno-app/src/components/ResponsePane/Timeline/buildEntries.jspackages/bruno-electron/src/ipc/network/index.jstests/request/timeline/timeline-nested-runrequest.spec.tstests/request/timeline/timeline-runrequest-network-error.spec.ts
Replace the generator-backed method-indicator assertion with a static, hand-authored collection (one request per HTTP method, in both bru and yml) so the expected badge set is fixed rather than derived from the generator's method-cycling. Add setupStaticFixture to preload a committed collection from disk (copied to a temp dir so the app never mutates the source). Also resolve a barrel collision: actions.ts now exports expandFolder (via the timeline change in usebruno#8047), which clashed with mounting.ts's duplicate. Drop the unused expandFolder/collapseFolder/isFolderExpanded helpers from mounting.ts (folder expansion is inlined in extractItemsFromContainer) so the utils/page barrel loads again.
* feat: npm package report and installation support (usebruno#8143) * feat: show scripted requests in timeline (usebruno#8047) * fix(proxy): proxy config export from v2 to import in v3 (usebruno#8112) * FIXED regression for proxy config from v2 to v3 * REMOVED console.log * ADDED test case with fixture to test proxy import * ADDED proxy handling for older brunoConfig in packages/bruno-electron/src/utils/collection-import.js * RESOLVED githiub converstation changed afterAll --> afterEach * ADDED guard to transformProxyConfig(brunoConfig.proxy) function * fix: route runner scripted-request/oauth2-debug timeline entries Use the enterprise per-iteration runner shape in the reducers, propagate iterationIndex on all run-folder-event emits, and fix the bruno-js test argument positions. --------- Co-authored-by: naman-bruno <[email protected]> Co-authored-by: Pooja <[email protected]> Co-authored-by: Abhishek Patil <[email protected]> Co-authored-by: lohit <[email protected]>

Description
JIRA
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.
Screen.Recording.2026-05-25.at.3.30.19.PM.mov
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
New Features
Improvements
Tests