[codex] Preserve review path resolution failures#3357
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This is a small, focused bug fix that improves error handling by preserving unexpected path-resolution failures instead of silently swallowing them. The change includes a corresponding test and has limited scope. You can customize Macroscope's approvability policy. Learn more. |
Summary
VcsRepositoryDetectionErrorvaluescauseand cover the failure pathVerification
vp test apps/server/src/review/ReviewService.test.tsvp check(passes with 20 pre-existing warnings)vp run typecheckNote
Medium Risk
Changes how review
cwdis canonicalized before workspace-boundary checks; misclassification could weaken validation or break legitimate previews, but scope is limited to review path resolution.Overview
Review workspace path validation no longer treats every
realPathfailure as a silent fallback to the lexical resolved path.canonicalizePathinReviewServicenow only falls back when the platform error isNotFound(path does not exist yet). Any otherPlatformErrorduring canonicalization fails with a structuredVcsRepositoryDetectionError(operation:ReviewService.assertWorkspaceBoundCwd.canonicalizePath), a clear detail message, and the originalPlatformErrorpreserved ascause.A new test drives an invalid
cwd(embedded null) throughgetDiffPreviewand asserts that failure shape, thatPlatformErroris on the cause, and that VCS detect is not invoked when canonicalization fails early.Reviewed by Cursor Bugbot for commit 5b28127. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve non-NotFound path resolution failures in
ReviewService.canonicalizePathPreviously,
canonicalizePathin ReviewService.ts silently swallowed allrealPatherrors by returning the resolved path. Now it only falls back onNotFounderrors; any otherPlatformErrorcausesgetDiffPreviewto fail early with aVcsRepositoryDetectionErrorthat includes the original error ascauseand contextual metadata. A new test in ReviewService.test.ts covers this path using an invalid NUL-containing cwd.Macroscope summarized 5b28127.