Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedjomlamladen(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/1045/headopened View on GitHub

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 05cd2f8.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: 6a399eac-b002-47f7-ba90-2dc4b9615b1c

      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

      You can get early access to new features in CodeRabbit.

      Enable the early_access setting to enable early access features such as new models, tools, and more.

    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. maria-rcks closed this

Sign in to join this conversation.