(Improvement): Capture richer rspec exception details#1085
Open
TylerJang27 wants to merge 1 commit intomainfrom
Open
(Improvement): Capture richer rspec exception details#1085TylerJang27 wants to merge 1 commit intomainfrom
TylerJang27 wants to merge 1 commit intomainfrom
Conversation
Use RSpec's ExceptionPresenter for failure_message so customers see what they're used to seeing in their console output: the Failure/Error source line, the exception message, and any "Caused by:" chain. Walk exception.cause for the backtrace field too so root causes aren't dropped, and truncate the middle (instead of the tail) of oversized fields so both the throw site and the project-local frames survive.
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1085 +/- ##
==========================================
+ Coverage 81.75% 82.01% +0.26%
==========================================
Files 69 69
Lines 14917 14917
==========================================
+ Hits 12195 12234 +39
+ Misses 2722 2683 -39 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improving what
rspec_trunk_flaky_testscaptures for failed examples so the data we report matches what users see in their RSpec console output.failure_messagenow delegates toRSpec::Core::Formatters::ExceptionPresenter#fully_formatted(with a no-op colorizer). That gives us the fullFailure/Error: <source line>header, the exception class and message, and anyCaused by:chain — instead of just<class>: <message>. Previously the source line and root-cause chain were silently dropped.backtraceuses RSpec'sformatted_backtrace(which applies the configured backtrace cleaner) and walksexception.causeso each cause's backtrace is appended. This recovers the chained backtraces that Ruby exposes via#causebut that we were ignoring.legacy_format_exception_message/legacy_format_exception_backtrace) and the new code rescuesStandardErrorto fall back if a future RSpec API shift breaks anything, so we don't regress existing behavior.Test plan
failure_messageandbacktrace.causechain (e.g. an error raised from inside a rescue) shows theCaused by:block infailure_messageand the cause's frames inbacktrace.RSpec::Core::MultipleExceptionError(test failure plus anafterhook failure) reports all sub-exceptions.https://claude.ai/code/session_01BHRe4t7dxsGyoMVhLrf3CF
Generated by Claude Code