[codex] structure workspace search failures#3352
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 PR adds structured error handling around native FileFinder calls, wrapping potential exceptions in typed errors with diagnostic context. The changes are defensive improvements to error reporting with no functional behavior changes beyond better exception handling. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate cdf3c1a
Co-authored-by: codex <codex@users.noreply.github.com>
cdf3c1a to
ecaab88
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 897e185
Co-authored-by: codex <codex@users.noreply.github.com> (cherry picked from commit c8454ad)
Summary
Verification
vp test apps/server/src/workspace/WorkspaceSearchIndex.test.ts(2 tests)vp check(passes with 20 pre-existing warnings)vp run typecheckSensitive-context follow-up\n- workspace search failures retain query length and effective page size rather than the raw query\n- cwd, reason, and exact thrown cause behavior remain unchanged
Note
Low Risk
Localized error-handling and observability changes in workspace search; behavior on success is unchanged aside from shorter public error messages.
Overview
Workspace search index errors are now typed and safer to log.
FileFinder.create,mixedSearch,scanFiles, andisScanningare wrapped inEffect.tryso thrown failures become tagged errors with an optionalcause; nativeok: falseresults still setreasonbut leavecauseunset.Search failures carry
queryLengthandpageSizeinstead of the query string, and user-facingmessagestrings no longer embedreason(details stay on the error fields).waitForScanis generalized with anonFailurehook so create vs refresh can mapisScanningthrows to the right error type.New Effect/Vitest coverage asserts cause preservation, returned-error handling, and that secrets in queries never appear on errors or messages.
Reviewed by Cursor Bugbot for commit 897e185. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure workspace search failures by catching raw exceptions as typed errors
FileFinder.create,mixedSearch,scanFiles, andisScanninginEffect.tryso unexpected thrown exceptions are converted intoWorkspaceSearchIndexCreateFailed,WorkspaceSearchIndexSearchFailed, orWorkspaceSearchIndexRefreshFailedinstead of propagating as raw defects.causefield to all three error classes, and addsqueryLength/pageSizefields toWorkspaceSearchIndexSearchFailedfor contextual debugging.reasondetail from error message getters so sensitive query content is not exposed in error messages.WorkspaceSearchIndex.test.tscovering error shaping, cause inclusion/exclusion, and message sanitization for create, search, and refresh operations.Macroscope summarized 897e185.