fix(tests): venue-parity interface probes must not pipe into grep -q - #1879
Merged
Conversation
The two layer-5 interface probes tested for a substring by piping the
captured output into `grep -q`. Under `set -o pipefail` (line 32) that
turns a SATISFIED contract into a probe failure whenever the payload is
larger than the pipe buffer: `grep -q` exits at the first match, and the
writer takes EPIPE on the remainder, so the pipeline reports the writer's
non-zero status even though the match succeeded.
Observed on macos-15-intel:
test_venue_parity_contract.sh: line 404: printf: write error: Broken pipe
INTERFACE CONTRACT: scripts/ci/smoke-artifact.sh --help must exit 0 and
print a Usage: block (rc=0)
VENUE PARITY CONTRACT VIOLATED — interface probes failed (layer 5)
rc=0 and the Usage: block was present — the match is exactly what made
grep exit early. `smoke-artifact.sh --help` is 698 bytes against a
512-byte PIPE_BUF, and prints `Usage:` on its first line, so the writer
is killed at the earliest possible moment. Whether the remaining write
lands before grep exits is a scheduling race, which is why this only
ever showed up on one runner.
Replace both pipelines with in-shell `case` matching: no subprocess, no
pipe, no race, and a strictly literal match (the second probe's "--help."
was previously a regex whose `.` matched any character).
Verified: the contract passes (18 --help entries, 8 strict-flag entries),
and the matcher still returns 0 for output with no Usage: block, so the
probe can still fail.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.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.
What
The two layer-5 interface probes in
tests/test_venue_parity_contract.shtested for a substring by piping captured output intogrep -q. Underset -o pipefailthat converts a satisfied contract into a probe failure.Why it fails
grep -qexits at the first match. If the payload exceeds the pipe buffer, the writer takesEPIPEon the remainder, andpipefailsurfaces the writer's non-zero status — even though the match succeeded.Observed on
macos-15-intel:Note
rc=0, and theUsage:block was present — the successful match is exactly what madegrepexit early.smoke-artifact.sh --helpis 698 bytes against a 512-bytePIPE_BUFand printsUsage:on its first line, so the writer is killed at the earliest possible moment. Whether its remaining write lands beforegrepexits is a scheduling race — hence a single-runner "flake" that is really a harness defect.Fix
Both pipelines become in-shell
casematching: no subprocess, no pipe, no race. The second probe also becomes a strictly literal match (its"Please consult --help."was previously a regex whose.matched any character).Verification
venue-parity contract OK/interface probes OK (18 --help entries, 8 strict-flag entries).Usage:block, so the probe can still fail. A gate that cannot fail would be worse than a flaky one.