Skip to content

fix(ws,sidebar): structured error payload and prevent horizontal overflow on project import#1045

Open
jomlamladen wants to merge 1 commit intopingdotgg:mainfrom
jomlamladen:fix/project-import-error-and-sidebar-overflow
Open

fix(ws,sidebar): structured error payload and prevent horizontal overflow on project import#1045
jomlamladen wants to merge 1 commit intopingdotgg:mainfrom
jomlamladen:fix/project-import-error-and-sidebar-overflow

Conversation

@jomlamladen
Copy link

@jomlamladen jomlamladen commented Mar 13, 2026

Summary

Fixes UX issues when adding a project with an invalid path: raw stack traces in error messages and horizontal scrollbar overflow in the sidebar.

What changed

  • Contracts: Added WsError schema and WS_ERROR_CODES for typed WebSocket error responses
  • Server: buildWsErrorForClient() normalizes errors to { code, message, path? } — users see "Project directory does not exist" instead of stack traces
  • Sidebar: min-w-0, overflow-hidden, break-words on add-project form to prevent horizontal overflow when error text is long

Why

  • Users saw full stack traces when adding non-existent paths
  • Long error text caused horizontal scroll in the sidebar
  • Structured errors are easier to extend and handle on the client

Before / After

Before: Raw stack trace in UI, horizontal scrollbar
After: Clean message "Project directory does not exist", text wraps without overflow

Screenshot 2026-03-13 at 23 05 11 Screenshot 2026-03-13 at 22 51 25 Screenshot 2026-03-13 at 22 51 15

Future improvement: A cleaner approach would be to add code and path to RouteRequestError when it is created. The current message based detection is used because Schema.is(RouteRequestError) did not reliably match when extracting the defect from Cause.squash.

Note

Add structured WsError payload with error codes and fix sidebar overflow on project import

  • Introduces WS_ERROR_CODES and a WsError schema in packages/contracts/src/ws.ts with code, message, and optional path fields, replacing the previous { message: string } shape.
  • Adds a buildWsErrorForClient utility in apps/server/src/wsServer.ts that maps internal Effect/Cause failures to structured errors, including specific codes for known project path errors.
  • Fixes horizontal overflow in apps/web/src/components/Sidebar.tsx by adding min-w-0, overflow-hidden, and break-words to the project path entry container and error message.
  • Behavioral Change: WebSocket error responses now require a code field; clients expecting only { message } will need to handle the new shape.

Macroscope summarized e82eac4.

…flow on project import

- Add WsError schema (code, message, path) and WS_ERROR_CODES in contracts
- Server returns typed errors instead of raw Cause.pretty stack traces
- PROJECT_DIR_NOT_EXIST / PROJECT_PATH_NOT_DIRECTORY with user-friendly message
- Path included for debugging but not displayed in UI
- Sidebar: min-w-0, overflow-hidden, break-words to prevent horizontal scroll
  when error messages or long paths are shown in add-project form
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 542133f9-4c1b-4dbb-acc5-9aa66c7b9187

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes with custom instructions.

Set the reviews.auto_title_instructions setting to generate a title for your PR based on the changes in the PR with custom instructions.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant