Skip to content

fix(tests): venue-parity interface probes must not pipe into grep -q - #1879

Merged
DeusData merged 1 commit into
mainfrom
fix/venue-parity-probe-sigpipe
Aug 28, 2026
Merged

fix(tests): venue-parity interface probes must not pipe into grep -q#1879
DeusData merged 1 commit into
mainfrom
fix/venue-parity-probe-sigpipe

Conversation

@DeusData

Copy link
Copy Markdown
Owner

What

The two layer-5 interface probes in tests/test_venue_parity_contract.sh tested for a substring by piping captured output into grep -q. Under set -o pipefail that converts a satisfied contract into a probe failure.

Why it fails

grep -q exits at the first match. If the payload exceeds the pipe buffer, the writer takes EPIPE on the remainder, and pipefail surfaces 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)

Note rc=0, and the Usage: block was present — the successful 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 its remaining write lands before grep exits is a scheduling race — hence a single-runner "flake" that is really a harness defect.

Fix

Both pipelines become in-shell case matching: 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

  • Contract passes: venue-parity contract OK / interface probes OK (18 --help entries, 8 strict-flag entries).
  • Negative control: the matcher still yields "absent" for output with no Usage: block, so the probe can still fail. A gate that cannot fail would be worse than a flaky one.

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>
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