feat: truncate long import traces with hidden count#6782
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR introduces truncation for long import traces in error diagnostics to improve readability. When a trace exceeds 4 entries, the middle portion is collapsed and replaced with … (N hidden), showing only the first 2 and last 2 entries.
Key changes:
- Truncation logic limits traces to 4 entries maximum (2 head + 2 tail) in non-verbose mode
- End-to-end test validates the truncation behavior with a 7-file import chain
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/helpers/format.ts | Implements truncation logic for module traces exceeding 4 entries |
| e2e/cases/diagnostic/import-traces-cut/index.test.ts | Tests truncation behavior in both dev and build modes |
| e2e/cases/diagnostic/import-traces-cut/src/*.js | Test fixtures creating a 7-level import chain to trigger truncation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Summary
This PR improves the readability of import trace output.
When an import trace is long, it now shows at most four entries. The middle part is collapsed and displayed as
… (N hidden).This keeps the most relevant context while significantly reducing log noise for large dependency chains.
Before
After
Checklist