Skip to content

build: guard grep pipeline against pipefail when no benchmark files exist#12877

Merged
kgryte merged 1 commit into
developfrom
philipp/ci-fix-random-benchmarks-2026-06-14
Jun 15, 2026
Merged

build: guard grep pipeline against pipefail when no benchmark files exist#12877
kgryte merged 1 commit into
developfrom
philipp/ci-fix-random-benchmarks-2026-06-14

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • fixes a 100%-failure-rate regression in the random_benchmarks CI workflow caused by set -o pipefail propagating grep's exit code 1 (no matches) through the benchmark-javascript make recipe pipeline when a randomly selected package has no benchmark/ directory

The top-level tools/make/Makefile sets .SHELLFLAGS := -eu -o pipefail -c, so every make recipe runs under bash -eu -o pipefail. In benchmark-javascript, the pipeline is:

$(FIND_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do ...

When FIND_BENCHMARKS_CMD returns no output (package has no benchmarks), grep exits 1. Under pipefail, that 1 propagates as the pipeline exit code even though the while loop exits 0. The recipe fails, and benchmark-random-javascript aborts via its || exit 1 guard.

The fix wraps grep in { grep ... || true; } so its no-match exit code does not propagate. Matching behavior and real benchmark failure semantics (the $(NODE) ... || exit 1 inside the loop) are preserved.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • None

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Identified via CI audit on 2026-06-14. The random_benchmarks workflow showed a 30/30 (100%) failure rate going back at least to 2026-05-16. All failures terminated at make[1]: Error 1 inside benchmark-javascript when the randomly selected package set included @stdlib/time/iso-weeks-in-year (no benchmark directory).

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code as part of an automated CI failure investigation routine.


@stdlib-js/reviewers


Generated by Claude Code

…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 kgryte added the CI Issue or pull request specific to continuous integration environments. label Jun 15, 2026
@kgryte kgryte marked this pull request as ready for review June 15, 2026 09:28
@kgryte kgryte requested a review from a team June 15, 2026 09:28
@kgryte kgryte merged commit 580c8bc into develop Jun 15, 2026
32 checks passed
@kgryte kgryte deleted the philipp/ci-fix-random-benchmarks-2026-06-14 branch June 15, 2026 09:29
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Issue or pull request specific to continuous integration environments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants