Repository navigation
fix(desktop): classify ETIMEDOUT filesystem errors as TIMEOUT instead of 500 - #6319
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe filesystem error type now accepts ChangesFilesystem timeout handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
No issues found across 2 files
Architecture diagram
sequenceDiagram
participant Client as Desktop Client
participant TRPC as tRPC Router
participant FsRouter as Filesystem Router
participant FsErr as withFsErrorTranslation
participant OS as OS Filesystem
Note over Client,OS: filesystem.listDirectory call flow
Client->>TRPC: tRPC request: filesystem.listDirectory
TRPC->>FsRouter: listDirectory()
FsRouter->>OS: fs.readdir() with { withFileTypes: true }
alt Normal filesystem
OS-->>FsRouter: Directory entries
FsRouter-->>Client: Success response
else Network/virtual mount timeout
OS-->>FsRouter: ETIMEDOUT errno
FsRouter->>FsRouter: Catch error with errno ETIMEDOUT
FsRouter->>FsErr: Translate error
FsErr->>FsErr: Lookup ERRNO_TO_TRPC map
alt ETIMEDOUT in map (NEW behavior)
FsErr-->>FsRouter: TRPCError with code "TIMEOUT"
FsRouter-->>Client: 408 TIMEOUT response (non-500)
else errno not in map (OLD behavior)
FsErr->>FsErr: Fall through to rethrow
FsErr-->>FsRouter: Error rethrown
FsRouter-->>Client: 500 INTERNAL_SERVER_ERROR
FsRouter->>TRPC: Report to Sentry
end
end
Note over FsErr: ERRNO_TO_TRPC mapping targets:<br/>EACCES → FORBIDDEN<br/>EPERM → FORBIDDEN<br/>ENOSPC → PRECONDITION_FAILED<br/>ETIMEDOUT → TIMEOUT (NEW)
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Problem
Seven Sentry issues (3+2+1+1+1+1+1 events, release 1.19.0) from a single user environment:
filesystem.listDirectoryfails withETIMEDOUTerrno errors (scandir/lstattiming out) and surfaces them as reportedINTERNAL_SERVER_ERROR500s. The user's repository lives on a network-backed/virtual filesystem mount where these syscalls can time out — an environmental failure, not an app bug.Root cause
The desktop filesystem router's
withFsErrorTranslationmaps known user-environment errnos to typed non-500TRPCErrors viaERRNO_TO_TRPC, butETIMEDOUTwas not in the map, so it fell through to the rethrow-and-report path.All seven issues cross this same boundary: every event is tagged
trpc_path: filesystem.listDirectory. The lstat-on-individual-file variants come from Node'sfs.readdir(..., { withFileTypes: true }), which falls back to a per-entrylstatwhen the filesystem returns unknown dirent types (typical of virtual/network mounts) — still inside the same translatedlistDirectorycall.Fix
Classification only (per the PR #6164 contract — no beforeSend filter, no Sentry-side suppression):
ETIMEDOUTtoFsErrnoCodeinapps/desktop/src/shared/fs-error-types.tsTIMEOUTinERRNO_TO_TRPCinapps/desktop/src/lib/trpc/routers/filesystem/index.tsError messages are preserved verbatim; unrecognized errnos still rethrow and stay reported 500s. Sibling errnos (
ENOTCONN,EIO) were deliberately not added:EIOcan indicate genuine disk/hardware failure that must keep reporting, andENOTCONNhas not been observed — no evidence to justify pre-classifying either.Verification
No existing tests cover these files; none were touched.
Refs DESKTOP-NT
Refs DESKTOP-NN
Refs DESKTOP-NY
Refs DESKTOP-NS
Refs DESKTOP-NR
Refs DESKTOP-NQ
Refs DESKTOP-NP
https://claude.ai/code/session_48e2c6bd-dc88-43af-8756-7d63377c3318
Summary by cubic
Classifies
ETIMEDOUTfilesystem errors asTIMEOUTin the Desktop filesystem TRPC router instead of 500. This prevents falseINTERNAL_SERVER_ERRORreports forfilesystem.listDirectoryon network/virtual mounts and aligns with DESKTOP-NT, DESKTOP-NN, DESKTOP-NY, DESKTOP-NS, DESKTOP-NR, DESKTOP-NQ, DESKTOP-NP.Written for commit e88e562. Summary will update on new commits.
Summary by CodeRabbit