build: guard grep pipeline against pipefail when no benchmark files exist#12877
Merged
Merged
Conversation
…xist
With `.SHELLFLAGS := -eu -o pipefail -c` set in the top-level Makefile,
a `grep` producing no matches (exit 1) inside a pipeline propagates its
non-zero status through the pipeline under pipefail, even when the trailing
`while` loop exits 0. This caused `benchmark-javascript` to fail for any
package that has no `benchmark/` directory (e.g., `@stdlib/time/iso-weeks-in-year`),
making `benchmark-random-javascript` abort on every such package.
Wrapping the `grep` in `{ grep ... || true; }` neutralizes the no-match exit
code without affecting the `while` loop's ability to propagate real benchmark
failures via `|| exit 1`.
https://claude.ai/code/session_01H4WFsxz2M5vVrTc74hFFqT
kgryte
approved these changes
Jun 15, 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.
Description
This pull request:
random_benchmarksCI workflow caused byset -o pipefailpropagatinggrep's exit code 1 (no matches) through thebenchmark-javascriptmake recipe pipeline when a randomly selected package has nobenchmark/directoryThe top-level
tools/make/Makefilesets.SHELLFLAGS := -eu -o pipefail -c, so every make recipe runs underbash -eu -o pipefail. Inbenchmark-javascript, the pipeline is:When
FIND_BENCHMARKS_CMDreturns no output (package has no benchmarks),grepexits 1. Underpipefail, that 1 propagates as the pipeline exit code even though thewhileloop exits 0. The recipe fails, andbenchmark-random-javascriptaborts via its|| exit 1guard.The fix wraps
grepin{ grep ... || true; }so its no-match exit code does not propagate. Matching behavior and real benchmark failure semantics (the$(NODE) ... || exit 1inside the loop) are preserved.Related Issues
This pull request has the following related issues:
Questions
No.
Other
Identified via CI audit on 2026-06-14. The
random_benchmarksworkflow showed a 30/30 (100%) failure rate going back at least to 2026-05-16. All failures terminated atmake[1]: Error 1insidebenchmark-javascriptwhen the randomly selected package set included@stdlib/time/iso-weeks-in-year(no benchmark directory).Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code as part of an automated CI failure investigation routine.
@stdlib-js/reviewers
Generated by Claude Code