Fix failure capture, redaction and snapshot resilience - #3
Merged
Conversation
Failed requests were never captured while the application exception handler was active. Illuminate\Routing\Pipeline renders throwables into responses before they reach global middleware, so the middleware catch block was only reachable under withoutExceptionHandling(), which is exactly what the test suite used. Capture now reads the throwable that Pipeline attaches to the rendered response, with a renderable() hook as a secondary path and deduplication through the request attribute. Other fixes: - timecode:replay passed an explicit false when --auth was absent, so replay.restore_auth_user never applied. - Truncated strings carried a literal \n instead of a newline, and were cut mid-character, producing invalid UTF-8 that made the whole snapshot fail to encode. - timecode:list failed outright when a single snapshot was unreadable, for example after an APP_KEY rotation. Such files are now skipped and reported to the log. - The service provider threw when no HTTP kernel was bound. ignore_exceptions now also lists AuthorizationException, RecordsNotFoundException and TokenMismatchException. Capture sees the original throwable rather than the one Laravel maps it to, so 403, 404 and 419 responses were recorded despite the intent of the defaults. Verified against a fresh Laravel 13.26.1 application on PHP 8.5.
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.
Failed requests were never captured while the application exception handler was active. Illuminate\Routing\Pipeline renders throwables into responses before they reach global middleware, so the middleware catch block was only reachable under withoutExceptionHandling(), which is exactly what the test suite used. Capture now reads the throwable that Pipeline attaches to the rendered response, with a renderable() hook as a secondary path and deduplication through the request attribute.
Other fixes:
ignore_exceptions now also lists AuthorizationException, RecordsNotFoundException and TokenMismatchException. Capture sees the original throwable rather than the one Laravel maps it to, so 403, 404 and 419 responses were recorded despite the intent of the defaults.
Verified against a fresh Laravel 13.26.1 application on PHP 8.5.