Skip to content

fix(ai): show platform-correct modifier key in AI shortcut hints - #8430

Merged
utkarsh-bruno merged 6 commits into
usebruno:mainfrom
ravindra-bruno:fix/bru-3646
Jul 6, 2026
Merged

utkarsh-bruno merged 6 commits into
usebruno:mainfrom
ravindra-bruno:fix/bru-3646

Conversation

@ravindra-bruno

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

Copy link
Copy Markdown
Collaborator

Description

BRU3646

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

What is the Bug?

The AI feature keyboard shortcut hints always display the macOS Command symbol (⌘), even on Windows and Linux where the modifier key is Ctrl. This makes the hint text incorrect for non-macOS users.

Steps to Reproduce

  1. Open Bruno on a Windows (or Linux) machine.
  2. Open the Script tab and the "Generate Post-Response Script" panel — observe the hint reads "⌘ + Enter to generate".
  3. Open Preferences > AI > Autocomplete and observe the Keymap row reads "⌘ + \ trigger", and the Manual trigger mode description references "⌘".

Expected Behaviour

The hint shows the platform-appropriate modifier key:

  • macOS → ⌘
  • Windows / Linux → Ctrl

Actual Behaviour

The hint hardcodes the macOS "⌘" symbol on all platforms, so Windows and Linux users see "⌘" instead of "Ctrl".

Summary by CodeRabbit

  • Bug Fixes

    • AI autocomplete keymap and manual trigger guidance now display the correct platform modifier label (⌘ on macOS, Ctrl on other systems) instead of a hardcoded value.
    • The AI assistant “generate shortcut” hint now reflects the platform-specific modifier key.
  • Tests

    • Added/extended unit and end-to-end coverage to verify modifier text renders correctly across platforms.
    • Updated test preferences/onboarding setup for more consistent AI UI runs.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a platform-aware modifier helper and uses it in AI shortcut hint text. Updates Jest and Playwright coverage to assert the platform-specific modifier text, and adjusts a preferences fixture for the browser test.

Changes

Platform Modifier Key Utility and AI Shortcut Hints

Layer / File(s) Summary
getPlatformModifierKey utility
packages/bruno-app/src/utils/common/platform.js
Adds getPlatformModifierKey() returning ⌘ on macOS and Ctrl otherwise.
AI UI shortcut hint text
packages/bruno-app/src/components/Preferences/AI/AutocompletePane.js
Imports the helper and uses it in the manual trigger description and keymap shortcut text.
Shortcut hint tests
packages/bruno-app/src/components/AIAssist/index.spec.js, packages/bruno-app/src/components/Preferences/AI/AutocompletePane.spec.js, tests/preferences/ai/ai-shortcut-hints.spec.ts, tests/preferences/ai/init-user-data/preferences.json
Mocks or derives the modifier key in tests, asserts the rendered shortcut text, and updates the browser-test fixture state.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • usebruno/bruno#8300: Updates the AI autocomplete UI and hints to use platform-specific modifier text.

Suggested reviewers: helloanoop, lohit-bruno, bijin-bruno, sid-bruno, vijayh-bruno

Poem

⌘ or Ctrl, the hint now knows,
Across each platform, clearly shows.
The rabbit taps the right key bright,
And tests confirm the copy’s right.
Small changes hop with tidy grace —
A shortcut fits each user’s place.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: showing the correct platform-specific modifier key in AI shortcut hints.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@packages/bruno-app/src/components/AIAssist/index.js`:
- Line 224: The platform-specific shortcut hint in AIAssist now varies between ⌘
and Ctrl, but the existing tests do not cover either branch. Update the AIAssist
spec to assert the rendered hint text for both macOS and non-macOS cases, using
getPlatformModifierKey() behavior, and add matching coverage in the
AutocompletePane spec so both components validate the expected shortcut copy.
🪄 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: 7ab634ce-33cd-4fb6-bef3-59d70557592b

📥 Commits

Reviewing files that changed from the base of the PR and between c01e4a0 and b6a73ea.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/AIAssist/index.js
  • packages/bruno-app/src/components/Preferences/AI/AutocompletePane.js
  • packages/bruno-app/src/utils/common/platform.js

Comment thread packages/bruno-app/src/components/AIAssist/index.js Outdated
@pull-request-size pull-request-size Bot added size/L and removed size/S labels Jun 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/bruno-app/src/components/Preferences/AI/AutocompletePane.spec.js (1)

51-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Parameterize the manual-trigger copy assertion.

Line 51 only exercises the Ctrl branch, so a macOS regression in Only on ⌘+\ would slip through. Mirror the it.each pattern used above so both platform-specific strings are covered.

Suggested change
-  it('shows the platform modifier in the manual trigger description', () => {
-    renderPane('Ctrl');
-    expect(screen.getByText('Only on Ctrl+\\')).toBeInTheDocument();
-  });
+  it.each([
+    ['macOS', '⌘'],
+    ['non-macOS', 'Ctrl']
+  ])('shows the %s modifier in the manual trigger description', (_platform, modifier) => {
+    renderPane(modifier);
+    expect(screen.getByText(`Only on ${modifier}+\\`)).toBeInTheDocument();
+  });

As per coding guidelines, “Add tests for any new functionality or meaningful changes” and “Cover both the ‘happy path’ and the realistically problematic paths.”

🤖 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/Preferences/AI/AutocompletePane.spec.js`
around lines 51 - 54, The manual-trigger copy test in AutocompletePane.spec.js
only covers the Ctrl case, so it can miss a macOS regression. Update the
existing assertion around renderPane and screen.getByText to use the same
it.each pattern as the other platform-dependent tests, covering both Ctrl and ⌘
variants of the manual-trigger description.

Source: Coding guidelines

tests/preferences/ai/ai-shortcut-hints.spec.ts (1)

13-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the manual-trigger hint in this flow too.

This spec only verifies the keymap row, but the same Preferences screen also changed the manual-trigger description. Adding that second visible assertion here keeps the E2E coverage aligned with the user-facing contract from this PR.

Suggested change
     const keymap = page.locator('.autocomplete-keymap');
     await expect(keymap).toBeVisible();
     await expect(keymap.getByText(expectedModifier, { exact: true })).toBeVisible();
+    await expect(page.getByText(`Only on ${expectedModifier}+\\`)).toBeVisible();

As per coding guidelines, “Add tests for any new functionality or meaningful changes.” As per path instructions, E2E tests should verify user-visible behaviour and use multiple assertions.

🤖 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/preferences/ai/ai-shortcut-hints.spec.ts` around lines 13 - 15, The AI
shortcut hints E2E test only checks the keymap row, so extend the existing
assertion sequence in ai-shortcut-hints.spec.ts to also verify the
manual-trigger hint is visible on the Preferences screen. Reuse the current test
flow and add a second user-facing assertion alongside the existing locator
checks, referencing the same page/locator setup so the coverage stays aligned
with the changed manual-trigger description.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/bruno-app/src/components/Preferences/AI/AutocompletePane.spec.js`:
- Around line 51-54: The manual-trigger copy test in AutocompletePane.spec.js
only covers the Ctrl case, so it can miss a macOS regression. Update the
existing assertion around renderPane and screen.getByText to use the same
it.each pattern as the other platform-dependent tests, covering both Ctrl and ⌘
variants of the manual-trigger description.

In `@tests/preferences/ai/ai-shortcut-hints.spec.ts`:
- Around line 13-15: The AI shortcut hints E2E test only checks the keymap row,
so extend the existing assertion sequence in ai-shortcut-hints.spec.ts to also
verify the manual-trigger hint is visible on the Preferences screen. Reuse the
current test flow and add a second user-facing assertion alongside the existing
locator checks, referencing the same page/locator setup so the coverage stays
aligned with the changed manual-trigger description.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4dbbe231-c812-453b-a9a9-e71a17679823

📥 Commits

Reviewing files that changed from the base of the PR and between b6a73ea and 8ea1eba.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/AIAssist/index.spec.js
  • packages/bruno-app/src/components/Preferences/AI/AutocompletePane.spec.js
  • tests/preferences/ai/ai-shortcut-hints.spec.ts
  • tests/preferences/ai/init-user-data/preferences.json
✅ Files skipped from review due to trivial changes (1)
  • tests/preferences/ai/init-user-data/preferences.json

utkarsh-bruno
utkarsh-bruno previously approved these changes Jul 2, 2026

@utkarsh-bruno utkarsh-bruno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Comment thread tests/preferences/ai/init-user-data/preferences.json

@utkarsh-bruno utkarsh-bruno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@utkarsh-bruno
utkarsh-bruno merged commit 6b90e80 into usebruno:main Jul 6, 2026
12 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants