Preserve trace file read causes#3300
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 Self-contained error handling improvement that adds a typed error class and structured logging for trace file read failures. The changes are well-tested and don't alter successful code paths, only improving failure observability. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate fdcd091
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 626ccfe
Summary
TraceFileReadErrorvalues with the failed path and exact platform causecatchTagsat the platform-error boundary, then recover withEffect.resultonly at the best-effort diagnostics aggregation boundaryValidation
vp test apps/server/src/diagnostics/TraceDiagnostics.test.ts(5 passed)vp check(passes with 20 pre-existing warnings)vp run typecheckNote
Low Risk
Scoped to local trace diagnostics reads; behavior for callers is unchanged at the public API except clearer errors and logs, with partial aggregation preserved.
Overview
Trace diagnostics now treat non–not-found filesystem errors as
TraceFileReadErroreffect failures (path,causeTag, and the originalPlatformErrorcause) instead of a'Failed'success variant fromreadTraceFile.At the aggregation boundary, each rotated file read is recovered with
Effect.resultso partial loads still work: failures emit a warning log annotated withtraceFilePath,errorTag, andcauseTag, while the publicdiagnostics.errorkeeps a path-derived message fromTraceFileReadError.message. Tests assert that shape and the logged annotations when one rotated file fails.Reviewed by Cursor Bugbot for commit 626ccfe. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve trace file read causes as structured errors in
TraceDiagnosticsTraceFileReadError, a tagged error class withtraceFilePath,causeTag, andcausefields, replacing the previousFailedresult payload for non-NotFoundread errors.readTraceFilenow fails withTraceFileReadError(instead of returning aFailedresult) when a trace file exists but cannot be read, whileNotFoundstill yields aMissingresult.TraceDiagnostics.readlogs a structured warning withtraceFilePath,errorTag, andcauseTagannotations on failure, and setsdiagnostics.errorto a standardized message withkind: 'trace-file-read-failed'.Failedresult shape will no longer receive it; failures now propagate as Effect failures and are surfaced in the error summary.Macroscope summarized 626ccfe.