Conversation
… ENOBUFS on large PRs The spec-gen-sdk-runner's getChangedFiles function used spawnSync to invoke PowerShell for git diff, which has a default maxBuffer of 1MB. For PRs with thousands of changed files (e.g. folder structure migrations), the output exceeds this limit causing ENOBUFS. This silently returns undefined, resulting in 0 changed files detected and a false-positive SDK validation pass. Replace the PowerShell-based implementation with the existing getChangedFiles from @azure-tools/specs-shared/changed-files, which uses simple-git (streaming spawn) and has no buffer size limitation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Next Steps to MergeNext steps that must be taken to merge this PR:
Comment generated by summarize-checks workflow run. |
qiaozha
approved these changes
Feb 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a false-positive success scenario in spec-gen-sdk-runner where large PRs with thousands of changed files could trigger an ENOBUFS error from PowerShell's spawnSync-based getChangedFiles. The undefined return from the failed script was silently coalesced to an empty array, causing the SDK validation step to be skipped while reporting success. The fix replaces the PowerShell approach with the existing simple-git-based implementation from @azure-tools/specs-shared/changed-files, which uses streaming and has no buffer size limit.
Changes:
- Replaced the PowerShell-based
getChangedFilesinutils.tswith an async wrapper around the sharedgetChangedFilesSharedfrom@azure-tools/specs-shared/changed-files - Propagated the async change through
detectChangedSpecConfigFilesinspec-helpers.tsand its call site incommands.ts - Updated all tests to use
mockResolvedValueandasync/awaitto match the new async API
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
eng/tools/spec-gen-sdk-runner/src/utils.ts |
Replaces PowerShell spawnSync-based getChangedFiles with an async wrapper over the shared simple-git implementation |
eng/tools/spec-gen-sdk-runner/src/spec-helpers.ts |
Adds async/await to detectChangedSpecConfigFiles to handle the now-async getChangedFiles |
eng/tools/spec-gen-sdk-runner/src/commands.ts |
Adds await to the detectChangedSpecConfigFiles call |
eng/tools/spec-gen-sdk-runner/test/spec-helpers.test.ts |
Updates all test cases to use mockResolvedValue and await for the async detectChangedSpecConfigFiles |
eng/tools/spec-gen-sdk-runner/test/commands.test.ts |
Updates detectChangedSpecConfigFiles spy mocks from mockReturnValue to mockResolvedValue |
mikeharder
approved these changes
Feb 28, 2026
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.
Problem
The
spec-gen-sdk-runner'sgetChangedFilesfunction usesspawnSyncto invoke PowerShell (pwsh) forgit diff, which has a defaultmaxBufferof 1MB. For PRs with thousands of changed files, the output exceeds this buffer limit, causing anENOBUFSerror.When this happens,
runPowerShellScriptreturnsundefined, which gets coalesced to an empty array (?? []). The pipeline then sees 0 changed files and skips SDK validation entirely — reporting a false-positive success.Pipeline log
Fix
Replace the PowerShell-based
getChangedFilesineng/tools/spec-gen-sdk-runner/src/utils.tswith the existinggetChangedFilesfrom@azure-tools/specs-shared/changed-files, which:simple-git(streamingspawn) instead ofspawnSync— no buffer size limitation