ci(build): fix find|head broken-pipe flake in Build Sample Tests - #66
Merged
Conversation
The 'Build tests (Linux/macOS only)' step used `find ... | head -1`, where
head closes the pipe after one line and find errors writing the rest
('find: write error'); under 'set -o pipefail' that failed the step. The race
surfaced as more test dirs were added. Switch to 'find ... -print -quit'
(broken-pipe-safe on GNU and BSD find) and guard on the go.mod path.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
The Build Sample Tests workflow's
Build tests (Linux/macOS only)step failed intermittently withfind: write error(seen on PR #65).Root cause is a classic broken-pipe race in
.github/workflows/build.yml:FIRST_TEST=$(find tests_source -name "go.mod" ... | head -1 | xargs dirname)head -1closes the pipe after the first line;findthen errors writing its remaining output, andset -o pipefail(+-e) promotes that to a step failure. Adding more test directories madefindwrite more, tipping the latent race into a consistent failure.Note: the step's actual
gobuild buildis guarded with|| echo, so this was never a real build/compile failure — purely the shell pipeline.Fix
Use
find ... -print -quit, which stops at the first match with no downstream pipe to break (supported by both GNU and BSDfind, so it holds on the ubuntu and macOS runners), and guard on the resolvedgo.modpath:Scope
CI-only, one file. Independent of the test work in #65 (which is mergeable regardless —
mainhas no required checks). Opening separately to keep that PR scoped to its tests.🤖 Generated with Claude Code