Skip to content

Commit 65d60e7

Browse files
committed
ci(pr): the changes classifier no longer fails open on a large file list
Found while proving the previous commit, in the same step, and the worse of the two defects because it fails OPEN. The classification was if printf '%s\n' "$FILES" | grep -qE '^(src/|internal/|...)'; then under the runner's `bash -eo pipefail`. grep -q exits on its first match; once the list is larger than the pipe buffer printf is still writing, dies of SIGPIPE, and pipefail turns the MATCH into a failed pipeline. The else branch then writes product=false, and pr-smoke and memwaste are skipped -- on exactly the PRs that change the most files. The previous commit's message flagged this as a follow-up; it is fixed here instead. The list now reaches grep through a here-string, so there is no pipe to break. The regex is unchanged. Proof, by executing the workflow's own run block under `bash -eo pipefail` with a stub gh, ten runs each: 849 KB list, first line src/a.c before: product=false 10/10 after: product=true 10/10 849 KB list, docs only product=false before and after small docs-only list product=false 422 fallback on the real DeusData#2246 product=true fallback, nonexistent merge ref rc 128, no output written It takes roughly 1,500 changed files to cross the buffer, which is why ordinary PRs never showed it. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent a262a35 commit 65d60e7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎.github/workflows/pr.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ jobs:
8282
FILES=$(git --git-dir="$CHANGES_GIT" diff --name-only --no-renames FETCH_HEAD^1 FETCH_HEAD)
8383
fi
8484
printf '%s\n' "$FILES"
85-
if printf '%s\n' "$FILES" | grep -qE '^(src/|internal/|install\.(sh|ps1)|scripts/build\.sh|scripts/smoke-test\.sh|scripts/smoke-local\.sh|scripts/smoke-fixture-server\.py|scripts/gen-third-party-notices\.sh|scripts/env\.sh|test-infrastructure/vm/(vm-smoke\.sh|windows-user-path-guard\.ps1)|Makefile\.cbm)'; then
85+
# A here-string, not a pipe: under this shell's pipefail, grep -q
86+
# exits on its first match, printf dies of SIGPIPE once the list
87+
# outgrows the pipe buffer, and the MATCH is then reported as a
88+
# failure -- product=false, smoke skipped, on the largest PRs.
89+
if grep -qE '^(src/|internal/|install\.(sh|ps1)|scripts/build\.sh|scripts/smoke-test\.sh|scripts/smoke-local\.sh|scripts/smoke-fixture-server\.py|scripts/gen-third-party-notices\.sh|scripts/env\.sh|test-infrastructure/vm/(vm-smoke\.sh|windows-user-path-guard\.ps1)|Makefile\.cbm)' <<<"$FILES"; then
8690
echo "product=true" >> "$GITHUB_OUTPUT"
8791
else
8892
echo "product=false" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)