Avoid stack overflow flattening test results#1183
Open
danmoseley wants to merge 1 commit intomicrosoft:mainfrom
Open
Avoid stack overflow flattening test results#1183danmoseley wants to merge 1 commit intomicrosoft:mainfrom
danmoseley wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Flatten large test result groups with iteration instead of spreading them into push, which can exceed JavaScript argument limits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1183 +/- ##
=======================================
Coverage ? 90.25%
=======================================
Files ? 19
Lines ? 2125
Branches ? 498
=======================================
Hits ? 1918
Misses ? 111
Partials ? 96
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ 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.
Note
This PR description was drafted with GitHub Copilot assistance.
Fixes #1179
Avoid stack overflow when flattening large result groups in
testplan_show_test_results_from_build_id.The previous implementation used:
For very large result groups, that spreads every result as a function argument and can exceed JavaScript engine argument limits, throwing
Maximum call stack size exceeded:This PR changes the flattening to iterate results and push one item at a time. The structure of the JSON is not changed -- it's the same structure the code would produce if it didn't stack overflow the engine by using spread.
GitHub issue number
#1179
Associated Risks
This is intended to be behavior-preserving except for avoiding the spread/argument-limit failure. It does not otherwise change result fetching or output shape.
Returning very large output successfully may now expose a limitation elsewhere.
✅ PR Checklist
🧪 How did you test it?
npm test -- --runTestsByPath test/src/tools/test-plan.test.ts --runInBandnpm run validate-tools