Fix CLI formatting for empty Blueprint error messages#3615
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the Playground CLI error formatter to preserve diagnostic details when top-level Error.message is empty but useful information exists in a nested cause chain (fixing blank Error: output for Blueprint runPHP fatals).
Changes:
- Exported and enhanced
describeError()to fall back to inspectingcause(and other object fields) whenError.messageis empty. - Added a focused unit test to assert
causeis used when the top-level message is empty. - Minor formatting cleanup in an existing test block.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/playground/cli/src/run-cli.ts | Improves describeError() formatting by traversing object fields (including cause) when needed; exports helper for testing. |
| packages/playground/cli/tests/run-cli.spec.ts | Adds regression test for empty-message Error with populated cause chain. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (error instanceof Error) { | ||
| return error.message; | ||
| return error.message || describeErrorObject(error); | ||
| } |
53ac404 to
1741aaa
Compare
|
Addressed Copilot review feedback in the latest push. Changes made:
Re-verified:
|
1741aaa to
2b9cec4
Compare
654b9bf to
b261a81
Compare
|
@chubes4 I am deeply sorry, I completely missed this assignment. I will review it now. |
mho22
left a comment
There was a problem hiding this comment.
Thanks for the contribution ! I added some suggestions.
|
No worries at all for the delay, thanks for reviewing. I pushed an update addressing your comments:
Verification: |
|
Thank you @chubes4 ! A few structural points on this revision:
What do you think ? |
|
Addressed the latest structural review feedback.\n\nChanges made:\n- folded |
|
@mho22 Thank you! |
What?
Preserves diagnostic details when the CLI catches an
Errorwith an empty top-levelmessagebut a populatedcausechain.This fixes
wp-playground-cli run-blueprintprinting only:for Blueprint
runPHPfatals whose PHP failure details are available through the nested cause.Fixes #3614.
Why?
The CLI
describeError()helper returnederror.messageimmediately forErrorinstances. When that message was empty, it never inspectedcause, even though the Blueprint/PHP failure details were present there.Evidence
A Homeboy rig was added first to reproduce and measure this path:
79d1d8c6-0bb5-4abb-8e18-5467e708cff252652822-759d-438c-a56e-8d4b6605dc33Baseline metrics:
Candidate metrics:
Candidate output includes the PHP fatal:
Testing Instructions
npx nx test-playground-cli playground-cli --testNamePattern="describeError"Also verified with the Homeboy rig:
AI assistance