Skip to content

fix: mock server minor bug fixes - #8923

Merged
sid-bruno merged 6 commits into
usebruno:mainfrom
utkarsh-bruno:fix/mock-server-issues
Aug 11, 2026
Merged

sid-bruno merged 6 commits into
usebruno:mainfrom
utkarsh-bruno:fix/mock-server-issues

Conversation

@utkarsh-bruno

@utkarsh-bruno utkarsh-bruno commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Small mock-server and response example polish pass: validation feedback for name/description limits, a layout fix for long descriptions, delay input decimals, and two UI spacing tweaks

Problem

  • Mock response name/description used silent maxLength hard stops (no inline error on create/edit/rename).
  • Edit name could fail to save when a sibling response already shared the same name (duplicate check ran even when the name was unchanged).
  • Long descriptions + View More pushed the header/Edit CTA out of reach (page felt stuck).
  • Mock server delay input accepted decimal values.
  • Sidebar mock-response rows and the response status dropdown needed tighter spacing/width.

Fix

  • Shared validators (getMockResponseNameLengthError, getMockResponseDescriptionError) show inline errors and validate on save.
  • Skip duplicate name check on save when the name is unchanged so edits still remain.
  • Cap expanded description height (max-height + overflow-y: auto).
  • Restrict decimal delay values in create modal + dashboard.
  • Slightly more sidebar item padding; wider status dropdown.

Screenshots

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.
  • I've run the claude code review skill locally.

Summary by CodeRabbit

  • New Features
    • Added validation for mock response names and descriptions, including a 1,000-character description limit.
    • Improved mock server delay fields to accept valid numeric input only.
    • Expanded response status fields and added scrolling for long response descriptions.
  • Bug Fixes
    • Existing mock responses can now be saved without triggering false duplicate-name errors.
    • Invalid response details prevent saving and display clear validation errors.
  • Style
    • Improved mock response sidebar spacing and form layout.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

Mock server updates

Layer / File(s) Summary
Response validation flow
packages/bruno-app/src/utils/mock-server/mock-responses.js, packages/bruno-app/src/utils/mock-server/mock-responses.spec.js, packages/bruno-app/src/components/MockServer/MockResponse/...
Shared name and description validation now applies across create, edit, rename, and save flows. Description input is validated instead of truncated.
Delay input handling
packages/bruno-app/src/utils/mock-server/mock-server-instances.js, packages/bruno-app/src/components/MockServer/CreateMockServerModal/index.js, packages/bruno-app/src/components/MockServer/MockServerDashboard/index.js
Delay values are normalized to digits-only strings, and invalid keyboard keys are blocked.
Response persistence update
packages/bruno-electron/src/app/mock-server/mock-response-store.js, packages/bruno-electron/tests/mock-response-store.test.js
Unchanged response names no longer trigger duplicate-name validation during updates. Regression coverage was added.
Response presentation updates
packages/bruno-app/src/components/MockServer/Sidebar/MockServers/MockResponseSidebarItem/index.js, packages/bruno-app/src/components/ResponseExample/...
Sidebar spacing, status input width, and description scrolling were adjusted.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: bijin-bruno

Poem

Digits march through delay fields bright,
Names and descriptions stay within sight.
Errors appear before saves proceed,
Unchanged names pass when updates need.
Mock responses now flow with care.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the mock server bug-fix scope, although it does not specify the validation, input, and UI changes.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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: 2

🤖 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/utils/mock-server/mock-responses.spec.js`:
- Around line 151-156: Add cases in the getMockResponseDescriptionError test
suite using surrounding whitespace: verify a padded description whose trimmed
content is exactly MOCK_RESPONSE_DESCRIPTION_MAX_LENGTH returns no error, and a
padded description whose trimmed content exceeds that limit returns the existing
length error. Keep the assertions focused on the trimming contract.

In `@packages/bruno-app/src/utils/mock-server/mock-server-instances.js`:
- Around line 409-415: Add unit tests in mock-server-instances.spec.js covering
toMockServerDelayInputValue with typed and pasted values, ensuring non-digit
characters are removed, and blockMockServerDelayKeys with invalid keys invoking
preventDefault while digit and editing keys remain allowed.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1512d31d-59c7-4581-a262-fd52e7f89843

📥 Commits

Reviewing files that changed from the base of the PR and between b287347 and 64bb9cb.

📒 Files selected for processing (14)
  • packages/bruno-app/src/components/MockServer/CreateMockServerModal/index.js
  • packages/bruno-app/src/components/MockServer/MockResponse/CreateMockResponseModal/index.js
  • packages/bruno-app/src/components/MockServer/MockResponse/MockResponseTopBar/index.js
  • packages/bruno-app/src/components/MockServer/MockResponse/RenameMockResponseModal/index.js
  • packages/bruno-app/src/components/MockServer/MockResponse/index.js
  • packages/bruno-app/src/components/MockServer/MockServerDashboard/index.js
  • packages/bruno-app/src/components/MockServer/Sidebar/MockServers/MockResponseSidebarItem/index.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleResponsePane/ResponseExampleStatusInput/StyledWrapper.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleTopBar/StyledWrapper.js
  • packages/bruno-app/src/utils/mock-server/mock-responses.js
  • packages/bruno-app/src/utils/mock-server/mock-responses.spec.js
  • packages/bruno-app/src/utils/mock-server/mock-server-instances.js
  • packages/bruno-electron/src/app/mock-server/mock-response-store.js
  • packages/bruno-electron/tests/mock-response-store.test.js

Comment thread packages/bruno-app/src/utils/mock-server/mock-responses.spec.js
Comment thread packages/bruno-app/src/utils/mock-server/mock-server-instances.js
@utkarsh-bruno utkarsh-bruno changed the title Fix/mock server issues fix: mock server minor bug fixes Aug 10, 2026
Comment thread packages/bruno-app/src/utils/mock-server/mock-server-instances.js
@sid-bruno
sid-bruno merged commit d72e0d0 into usebruno:main Aug 11, 2026
14 of 17 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.

2 participants