Skip to content

ci(build): fix find|head broken-pipe flake in Build Sample Tests - #66

Merged
ubercylon8 merged 1 commit into
mainfrom
fix/build-yml-broken-pipe
Jul 8, 2026
Merged

ci(build): fix find|head broken-pipe flake in Build Sample Tests#66
ubercylon8 merged 1 commit into
mainfrom
fix/build-yml-broken-pipe

Conversation

@ubercylon8

Copy link
Copy Markdown
Owner

Problem

The Build Sample Tests workflow's Build tests (Linux/macOS only) step failed intermittently with find: 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 -1 closes the pipe after the first line; find then errors writing its remaining output, and set -o pipefail (+ -e) promotes that to a step failure. Adding more test directories made find write more, tipping the latent race into a consistent failure.

Note: the step's actual gobuild build is 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 BSD find, so it holds on the ubuntu and macOS runners), and guard on the resolved go.mod path:

FIRST_GOMOD=$(find tests_source -name "go.mod" ... -print -quit)
if [ -n "$FIRST_GOMOD" ]; then
  FIRST_TEST=$(dirname "$FIRST_GOMOD")
  ./utils/gobuild build "$FIRST_TEST" || echo "..."
fi

Scope

CI-only, one file. Independent of the test work in #65 (which is mergeable regardless — main has no required checks). Opening separately to keep that PR scoped to its tests.

🤖 Generated with Claude Code

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>
@ubercylon8
ubercylon8 merged commit cada371 into main Jul 8, 2026
14 checks passed
@ubercylon8
ubercylon8 deleted the fix/build-yml-broken-pipe branch July 8, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant