Repository navigation
fix(scripts): read gh replies over 1 MiB in release:notes and the sweeps - #5410
Conversation
run() in scripts/release-notes.mjs called spawnSync with Node's default 1 MiB maxBuffer, so the src/ tree query at v2.2.0's merge commit (1,087,532 bytes) aborted the run with ENOBUFS. Pass a 256 MiB maxBuffer. scripts/lib/sweep.mjs's gh() gets the same: the Dependabot alert listing is about 7 KB per alert, so ~150 open alerts would overflow it. Tests drive the real spawnSync with a >1 MiB reply, and check a genuine spawn error is still rethrown. Closes #5339 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change to support larger GitHub CLI replies while retaining a bounded buffer.
No open issues 🎉
What changed in this PR
Fixes #5339 by allowing release-note generation and dependency sweeps to read GitHub CLI replies larger than Node’s default 1 MiB buffer, while retaining a bounded limit.
Changes:
- Sets an explicit 256 MiB buffer limit in both subprocess helpers.
- Adds regression tests using real subprocesses to verify large replies succeed and genuine spawn errors are still rethrown.
| File | Description |
|---|---|
scripts/release-notes.test.mjs |
Tests large file-list replies and spawn-error propagation. |
scripts/release-notes.mjs |
Applies the exported 256 MiB limit to subprocess output. |
scripts/lib/sweep.test.mjs |
Tests large CLI replies and spawn-error propagation. |
scripts/lib/sweep.mjs |
Applies the exported 256 MiB limit to the shared gh() helper. |
Review effort: Balanced
|
Copilot round 1: clean ("Approval recommended", no findings, no inline comments, no suppressed comments). No reply threads were needed. The loop has converged on its first clean round, with no confirming round per |
Closes #5339
Description
run()inscripts/release-notes.mjscalledspawnSyncwithout amaxBuffer, so Node's 1 MiB default applied. The GraphQL query that listssrc/at v2.2.0's merge commit returns 1,087,532 bytes, which madenpm run release:notesthrowspawnSync gh ENOBUFSbefore producing any notes.run()now passesmaxBuffer: MAX_BUFFER(256 MiB, exported). That is far beyond any reply the script reads, and it still caps a runaway one.scripts/lib/sweep.mjs'sgh(), as the issue asked: I fixed it the same way (GH_MAX_BUFFER, 256 MiB). Its largest reply is the Dependabot alert listing (--paginate --slurp, every open alert). That listing is 0 bytes today because no alerts are open. But one page of 99 of this repo's fixed alerts measured 702,259 bytes, about 7 KB per alert, so roughly 150 open alerts would overflow 1 MiB and abortdependabot-alerts. That is a plausible backlog after a quiet spell. The othergh()replies (the issue listing of up to 500 sweep issues with their bodies, and a comment thread through--slurp) grow the same way, but more slowly.Server Details
scripts/.scripts/release-notes.mjs(run()),scripts/lib/sweep.mjs(gh()), and their tests.Motivation and Context
See #5339. The
src/tree only grows, so every release after v2.2.0 would fail the same way without this fix.How Has This Been Tested?
No client-observable surface (scripts only), so the evidence is a targeted probe.
Before/after on the real overflowing call.
packagesAt(spawnSync, "60200eb7…")is theexpr=<sha>:srcquery the issue names, run against GitHub:(The issue's full
--milestone v2.2.0command now stops earlier, on the script's own "tag v2.2.0 already exists" check, because v2.2.0 has shipped. So the probe calls the overflowing lookup directly.)Tests. Each file gets two new tests. They drive the real
spawnSync, withghswapped for anode -ethat writes 2 MiB of stdout, so the optionsrun()/gh()pass decide the outcome:release-notes.test.mjs: a reply over 1 MiB gets throughfilesOf(all 131,072 lines), and a genuine spawn error (a missing binary,ENOENT) is still rethrown.lib/sweep.test.mjs: the same pair forgh().Planted defect: with the two
maxBufferlines deleted, both over-1 MiB tests fail withspawnSync … ENOBUFS(67 pass, 2 fail). With the fix, 69 pass, 0 fail.npm run local:gate: exit 0.Breaking Changes
None.
Types of changes
Checklist
npm run changeset) if this changes what a TypeScript server publishes (not applicable: scripts only)🤖 Generated with Claude Code