refactor(ai): moved AI Assist from floating overlay into request pane and collection/folder settings tab bars#8693
Conversation
WalkthroughAI Assist is moved from editor bodies into collection, folder, and request-pane tab areas. New orchestration components resolve editable targets and dispatch updates, while editor-level integrations are removed and placement behavior is covered by Playwright tests. ChangesAI Assist relocation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant SettingsAiAssist
participant TabBarAiAssist
participant AIAssist
participant Redux
User->>SettingsAiAssist: select supported settings tab
SettingsAiAssist->>Redux: read focused tab and editable content
SettingsAiAssist->>AIAssist: render context and apply handler
User->>TabBarAiAssist: select supported request tab
TabBarAiAssist->>Redux: read request content and tab state
TabBarAiAssist->>AIAssist: render context and apply handler
AIAssist->>Redux: dispatch generated content update
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)tests/ai-assist/init-user-data/preferences.jsonTraceback (most recent call last): 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.
🧹 Nitpick comments (1)
packages/bruno-app/src/components/CollectionSettings/Script/index.js (1)
29-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the new shared
getActiveScriptTabhelper instead of the local duplicate.This file still computes the active script tab inline, duplicating the exact logic this PR extracted into
getActiveScriptTab.jsand already adopted inRequestPane/Script/index.js,TabBarAiAssist, andSettingsAiAssist. Consolidating avoids the two copies silently diverging later.♻️ Proposed refactor
- const getDefaultTab = () => { - const hasPreRequestScript = requestScript && requestScript.trim().length > 0; - return hasPreRequestScript ? 'pre-request' : 'post-response'; - }; - - const activeTab = scriptPaneTab || getDefaultTab(); + const activeTab = getActiveScriptTab(scriptPaneTab, requestScript);And import it at the top:
+import getActiveScriptTab from '../../RequestPane/Script/getActiveScriptTab';🤖 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/CollectionSettings/Script/index.js` around lines 29 - 34, Replace the local getDefaultTab logic and activeTab calculation in the script settings component with the shared getActiveScriptTab helper, importing it from its existing module. Pass the same requestScript and scriptPaneTab values so the current tab-selection behavior remains unchanged.
🤖 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/CollectionSettings/Script/index.js`:
- Around line 29-34: Replace the local getDefaultTab logic and activeTab
calculation in the script settings component with the shared getActiveScriptTab
helper, importing it from its existing module. Pass the same requestScript and
scriptPaneTab values so the current tab-selection behavior remains unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d6ddb0a7-ad0f-47d1-8d5c-ee2cf1b8db44
📒 Files selected for processing (22)
packages/bruno-app/src/components/AIAssist/StyledWrapper.jspackages/bruno-app/src/components/CollectionApp/index.jspackages/bruno-app/src/components/CollectionSettings/Docs/index.jspackages/bruno-app/src/components/CollectionSettings/Script/index.jspackages/bruno-app/src/components/CollectionSettings/Tests/index.jspackages/bruno-app/src/components/CollectionSettings/index.jspackages/bruno-app/src/components/Documentation/index.jspackages/bruno-app/src/components/FolderSettings/Documentation/index.jspackages/bruno-app/src/components/FolderSettings/Script/index.jspackages/bruno-app/src/components/FolderSettings/StyledWrapper.jspackages/bruno-app/src/components/FolderSettings/Tests/index.jspackages/bruno-app/src/components/FolderSettings/index.jspackages/bruno-app/src/components/RequestPane/AppCodeEditor/index.jspackages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.jspackages/bruno-app/src/components/RequestPane/GrpcRequestPane/index.jspackages/bruno-app/src/components/RequestPane/HttpRequestPane/index.jspackages/bruno-app/src/components/RequestPane/Script/getActiveScriptTab.jspackages/bruno-app/src/components/RequestPane/Script/index.jspackages/bruno-app/src/components/RequestPane/TabBarAiAssist/index.jspackages/bruno-app/src/components/RequestPane/Tests/index.jspackages/bruno-app/src/components/RequestPane/WSRequestPane/index.jspackages/bruno-app/src/components/SettingsAiAssist/index.js
💤 Files with no reviewable changes (1)
- packages/bruno-app/src/components/FolderSettings/StyledWrapper.js
… and collection/folder settings tab bars
3c65051 to
948bd60
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/bruno-app/src/utils/tabs/index.js (1)
22-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd focused coverage for the fallback selection.
Please test explicit tab precedence, whitespace-only scripts selecting
post-response, and non-empty scripts selectingpre-request.🤖 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/utils/tabs/index.js` around lines 22 - 26, Add focused tests for getActiveScriptTab covering explicit scriptPaneTab precedence, whitespace-only requestScript falling back to post-response, and non-empty requestScript selecting pre-request. Keep the tests limited to these fallback-selection behaviors.
🤖 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/utils/tabs/index.js`:
- Around line 22-26: Add focused tests for getActiveScriptTab covering explicit
scriptPaneTab precedence, whitespace-only requestScript falling back to
post-response, and non-empty requestScript selecting pre-request. Keep the tests
limited to these fallback-selection behaviors.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3938e077-3396-4ecc-9d42-82835da18bd0
📒 Files selected for processing (23)
packages/bruno-app/src/components/AIAssist/StyledWrapper.jspackages/bruno-app/src/components/AIAssist/index.jspackages/bruno-app/src/components/CollectionApp/index.jspackages/bruno-app/src/components/CollectionSettings/Docs/index.jspackages/bruno-app/src/components/CollectionSettings/Script/index.jspackages/bruno-app/src/components/CollectionSettings/Tests/index.jspackages/bruno-app/src/components/CollectionSettings/index.jspackages/bruno-app/src/components/Documentation/index.jspackages/bruno-app/src/components/FolderSettings/Documentation/index.jspackages/bruno-app/src/components/FolderSettings/Script/index.jspackages/bruno-app/src/components/FolderSettings/StyledWrapper.jspackages/bruno-app/src/components/FolderSettings/Tests/index.jspackages/bruno-app/src/components/FolderSettings/index.jspackages/bruno-app/src/components/RequestPane/AppCodeEditor/index.jspackages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.jspackages/bruno-app/src/components/RequestPane/GrpcRequestPane/index.jspackages/bruno-app/src/components/RequestPane/HttpRequestPane/index.jspackages/bruno-app/src/components/RequestPane/Script/index.jspackages/bruno-app/src/components/RequestPane/TabBarAiAssist/index.jspackages/bruno-app/src/components/RequestPane/Tests/index.jspackages/bruno-app/src/components/RequestPane/WSRequestPane/index.jspackages/bruno-app/src/components/SettingsAiAssist/index.jspackages/bruno-app/src/utils/tabs/index.js
💤 Files with no reviewable changes (1)
- packages/bruno-app/src/components/FolderSettings/StyledWrapper.js
🚧 Files skipped from review as they are similar to previous changes (19)
- packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js
- packages/bruno-app/src/components/FolderSettings/index.js
- packages/bruno-app/src/components/RequestPane/WSRequestPane/index.js
- packages/bruno-app/src/components/FolderSettings/Documentation/index.js
- packages/bruno-app/src/components/RequestPane/GrpcRequestPane/index.js
- packages/bruno-app/src/components/RequestPane/TabBarAiAssist/index.js
- packages/bruno-app/src/components/SettingsAiAssist/index.js
- packages/bruno-app/src/components/CollectionSettings/Tests/index.js
- packages/bruno-app/src/components/RequestPane/Script/index.js
- packages/bruno-app/src/components/CollectionSettings/index.js
- packages/bruno-app/src/components/CollectionSettings/Script/index.js
- packages/bruno-app/src/components/AIAssist/StyledWrapper.js
- packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js
- packages/bruno-app/src/components/FolderSettings/Tests/index.js
- packages/bruno-app/src/components/RequestPane/AppCodeEditor/index.js
- packages/bruno-app/src/components/RequestPane/Tests/index.js
- packages/bruno-app/src/components/CollectionApp/index.js
- packages/bruno-app/src/components/Documentation/index.js
- packages/bruno-app/src/components/FolderSettings/Script/index.js
…equest pane, collection and folder settings
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/ai-assist/ai-assist-placement.spec.ts`:
- Line 24: Centralize all inline Playwright locators and actions from
tests/ai-assist/ai-assist-placement.spec.ts: replace the loaded-state waits at
lines 24, 59, and 89 with a shared utility under tests/utils/page/*; move the AI
Assist trigger locators at lines 38-51, 67-81, and 99-113 into centralized
locators; and replace the .editing-mode interactions at lines 53-54, 83-84, and
115-116 with centralized semantic, user-facing locators.
🪄 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: 627afe6c-7581-49de-8867-f80e53cce996
📒 Files selected for processing (2)
tests/ai-assist/ai-assist-placement.spec.tstests/ai-assist/init-user-data/preferences.json
| }); | ||
|
|
||
| test('request pane: AI Assist sits in the tab bar, docs only in edit mode', async ({ pageWithUserData: page, createTmpDir }) => { | ||
| await page.locator('[data-app-state="loaded"]').waitFor(); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Centralize locators and avoid inline raw selectors.
Raw selectors like page.locator() and page.getByTestId() are inlined throughout the spec. As per path instructions and the Playwright testing guide, locators and actions must be centralized under tests/utils/page/* (e.g., in tests/utils/page/locators.ts). Additionally, avoid using brittle CSS class selectors like .editing-mode in favor of semantic, user-facing locators.
tests/ai-assist/ai-assist-placement.spec.ts#L24-L24: Extract the[data-app-state="loaded"]wait into a centralized page utility.tests/ai-assist/ai-assist-placement.spec.ts#L38-L51: Move the AI Assist triggergetByTestIdlocators into centralized locators.tests/ai-assist/ai-assist-placement.spec.ts#L53-L54: Centralize the.editing-modeinteraction and prefer a semantic selector instead of a CSS class.tests/ai-assist/ai-assist-placement.spec.ts#L59-L59: Extract the[data-app-state="loaded"]wait into a centralized page utility.tests/ai-assist/ai-assist-placement.spec.ts#L67-L81: Move the AI Assist triggergetByTestIdlocators into centralized locators.tests/ai-assist/ai-assist-placement.spec.ts#L83-L84: Centralize the.editing-modeinteraction and prefer a semantic selector instead of a CSS class.tests/ai-assist/ai-assist-placement.spec.ts#L89-L89: Extract the[data-app-state="loaded"]wait into a centralized page utility.tests/ai-assist/ai-assist-placement.spec.ts#L99-L113: Move the AI Assist triggergetByTestIdlocators into centralized locators.tests/ai-assist/ai-assist-placement.spec.ts#L115-L116: Centralize the.editing-modeinteraction and prefer a semantic selector instead of a CSS class.
📍 Affects 1 file
tests/ai-assist/ai-assist-placement.spec.ts#L24-L24(this comment)tests/ai-assist/ai-assist-placement.spec.ts#L38-L51tests/ai-assist/ai-assist-placement.spec.ts#L53-L54tests/ai-assist/ai-assist-placement.spec.ts#L59-L59tests/ai-assist/ai-assist-placement.spec.ts#L67-L81tests/ai-assist/ai-assist-placement.spec.ts#L83-L84tests/ai-assist/ai-assist-placement.spec.ts#L89-L89tests/ai-assist/ai-assist-placement.spec.ts#L99-L113tests/ai-assist/ai-assist-placement.spec.ts#L115-L116
🤖 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/ai-assist/ai-assist-placement.spec.ts` at line 24, Centralize all
inline Playwright locators and actions from
tests/ai-assist/ai-assist-placement.spec.ts: replace the loaded-state waits at
lines 24, 59, and 89 with a shared utility under tests/utils/page/*; move the AI
Assist trigger locators at lines 38-51, 67-81, and 99-113 into centralized
locators; and replace the .editing-mode interactions at lines 53-54, 83-84, and
115-116 with centralized semantic, user-facing locators.
Source: Path instructions
[JIRA- BRU-3883]
Description
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.
Alignments for AiAssist
Request Level



Folder Level
Collection Level
Summary by CodeRabbit