From ed6a19e05bbab07ec020ebf3af6253bd4a3134ce Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza Date: Tue, 28 Jul 2026 10:25:21 -0300 Subject: [PATCH] fix(ci): raise the git ls-files buffer in check:tracked-artifacts (#8844) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ci): raise the git ls-files buffer in check:tracked-artifacts `execFileSync` defaults to a 1 MiB stdout buffer and throws ENOBUFS past it. `git ls-files -s` on this repo is already at 1,042,494 bytes across 11,091 tracked files — 6,082 bytes from the ceiling. Any PR adding roughly sixty files crosses it. That matters more than a failing script: the check runs on pre-commit, so once the listing crosses 1 MiB, committing breaks for everyone working the repo, not just for the change that happened to cross it. It is not a hypothetical — the private EE fork hit it this week when a sync landed ~214 translation files and pushed the listing 504 bytes over; every commit there failed the hook until this same fix landed. Both call sites now share a GIT_LS_OPTS with a 64 MiB ceiling — far above any plausible tree, rather than just above today's, since the listing only grows. * docs(changelog): add fragment for #8844 Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --- .../fixes/8844-tracked-artifacts-ls-files-buffer.md | 1 + scripts/check/check-tracked-artifacts.mjs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelog.d/fixes/8844-tracked-artifacts-ls-files-buffer.md diff --git a/changelog.d/fixes/8844-tracked-artifacts-ls-files-buffer.md b/changelog.d/fixes/8844-tracked-artifacts-ls-files-buffer.md new file mode 100644 index 0000000000..e6c649307d --- /dev/null +++ b/changelog.d/fixes/8844-tracked-artifacts-ls-files-buffer.md @@ -0,0 +1 @@ +- **CI**: `check:tracked-artifacts` raises the `git ls-files` stdout ceiling to 64 MiB — the default 1 MiB `execFileSync` buffer had only ~6 KB of headroom against the tracked tree, and overflowing it throws ENOBUFS in the pre-commit hook, breaking `git commit` for everyone working the repo diff --git a/scripts/check/check-tracked-artifacts.mjs b/scripts/check/check-tracked-artifacts.mjs index a0324fc168..dddca935d1 100644 --- a/scripts/check/check-tracked-artifacts.mjs +++ b/scripts/check/check-tracked-artifacts.mjs @@ -51,8 +51,17 @@ export function checkTrackedArtifacts(trackedFiles, trackedSymlinks = []) { return violations; } +/** + * `execFileSync` defaults to a 1 MiB stdout buffer and throws ENOBUFS past it. + * This check runs on pre-commit, so crossing that line breaks committing for + * the whole repo, not just the change that crossed it. `git ls-files -s` is + * already at ~1.04 MB here and only grows, so the ceiling is set far above any + * plausible tree instead of just above today's. + */ +const GIT_LS_OPTS = { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }; + function getTrackedFiles() { - const output = execFileSync("git", ["ls-files"], { encoding: "utf8" }); + const output = execFileSync("git", ["ls-files"], GIT_LS_OPTS); return output .split("\n") .map((l) => l.trim()) @@ -62,7 +71,7 @@ function getTrackedFiles() { function getTrackedSymlinks() { // git ls-files -s prints: \t // mode 120000 = symlink - const output = execFileSync("git", ["ls-files", "-s"], { encoding: "utf8" }); + const output = execFileSync("git", ["ls-files", "-s"], GIT_LS_OPTS); const symlinks = []; for (const line of output.split("\n")) { if (line.startsWith("120000")) {