[13.x] Promote nested data to top-level managed queue event - #61209
Conversation
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
There was a problem hiding this comment.
Pull request overview
This PR updates Laravel Cloud managed-queue failed job telemetry to surface key nested fields (job display name and a compact exception preview) as top-level event properties, and expands test coverage around exception preview formatting and UTF-8 handling.
Changes:
- Add
exception_preview(truncated) andjob_nameto the managed queuefailed_jobevent payload. - Expand Cloud queue tests to validate exception preview formatting (with/without message), UTF-8 sanitization, and job display name promotion.
- Update the Events test double to parse the JSON stream written by
Illuminate\Foundation\Cloud\Events.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/Foundation/Cloud/QueueTest.php | Adds/adjusts assertions for exception_preview, job_name, UTF-8 sanitization, and upgrades the Events fake to decode written JSON lines. |
| src/Illuminate/Foundation/Cloud/FailedJobProvider.php | Emits new top-level fields (exception_preview, job_name) for managed-queue failed job events. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| limit: 1000, | ||
| end: '[truncated due size...]'), | ||
| 'job_name' => $payload['displayName'] ?? '', | ||
| 'exception' => (string) $exception, |
There was a problem hiding this comment.
mb_convert_encoding is redundant here. Our event class handles converting everything to UTF-8.
|
|
||
| foreach (explode("\n", rtrim($payload, "\n")) as $write) { | ||
| $this->emitted[] = json_decode($write, associative: true); | ||
| } |
There was a problem hiding this comment.
This refactor allows us to see what was really sent to the socket after being encoded. This helps with our UTF-8 assertions.
| 'payload' => $payload, | ||
| 'exception' => (string) mb_convert_encoding($exception, 'UTF-8'), | ||
| 'exception_preview' => mb_substr( | ||
| string: $exception->getMessage() |
There was a problem hiding this comment.
This matches how PHP formats exception messages (https://github.com/php/php-src/blob/6901c87aeabf28cbb08dadc2ac64d1dabfdfdd3c/Zend/zend_exceptions.c#L788-L799)
Managed queue event payload improvements.
Once merged, this will be back ported to all versions supporting managed queues.