Skip to content

ci: pipefail, so a failing swift test can actually fail the mac job - #490

Merged
GoKubar merged 2 commits into
mainfrom
agent/kabir-claude/ci-pipefail
Sep 15, 2026
Merged

GoKubar merged 2 commits into
mainfrom
agent/kabir-claude/ci-pipefail

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

The hole

run: swift test 2>&1 | tee swift-test.log | grep -vE '^\s*$' | tail -n 400

A run: step's default shell is bash -e, and a pipeline's exit status is its last command's. tail always succeeds, so this step returned 0 regardless of how many tests failed:

$ bash -e -c 'false | tee /dev/null | tail -n 1; echo "status=$?"'
status=0
$ bash -e -c 'set -o pipefail; false | tee /dev/null | tail -n 1'
$ echo $?
1

The mac job has been reporting success over real test failures.

What it was hiding

Gating main on mac-m1max-a with the helpers wired in, 7 tests fail that CI calls green:

Test
CaptureAcceptanceTests 2
NavigationMultiFileV2Tests 2
NavigationRealCompilerTests 1
OutputBoundsTests 2

All deterministic — identical across two consecutive runs, so none of them are load-sensitive flakes.

The compounding one

scripts/ci/build-helpers.sh | tee -a "$GITHUB_ENV" has the same flaw, in ci.yml and release.yml. It is worse than it looks: that script prints the FLASHTEX_* lines the tests read. If it fails partway, tee still returns 0, the lines never reach the environment, and the ~126 tests that drive a real compiler/render/preview-controller/bridge binary all XCTSkip. The job then goes green having exercised none of the Rust↔Swift boundary.

That is the shape of failure that let the help.replacement contract break (#488) sit on main: the only tests that could see it were skipping.

default `swift test`:  1234 tests, 137 skipped
with the helpers:      1234 tests,  12 skipped

Note

The iPad job already wraps both of its piped xcodebuild steps in set -o pipefail. These three steps are the ones that missed it, so this matches existing convention rather than introducing one.

Expect red

The mac job will start failing until those 7 are fixed. That is the point of the change — it is currently green because it cannot be anything else. The 7 are pre-existing and unrelated to this PR; I am working them next and can hold this until they land if you would rather not see main red.

Implementation-Agent: orchestrator-astra
Commit-Executor: orchestrator-astra (direct; Cursor usage limit)

The step read

  run: swift test 2>&1 | tee swift-test.log | grep -vE '^\s*$' | tail -n 400

A `run:` step's default shell is `bash -e`, and a pipeline's exit status is its
LAST command's. `tail` always succeeds, so the step returned 0 no matter how
many tests failed. `bash -e -c 'false | tee /dev/null | tail -n1'` exits 0;
with `set -o pipefail` it exits 1.

The mac job has therefore been reporting success over real failures. Gating
main on `mac-m1max-a` with the helpers wired in finds 7 failing tests that CI
called green (capture acceptance 2, multi-file navigation 2, real-compiler
spans 1, output bounds 2).

`scripts/ci/build-helpers.sh | tee -a "$GITHUB_ENV"` has the same hole, in
both ci.yml and release.yml, and it compounds: a failed helper build is hidden
by `tee`, the FLASHTEX_* lines never reach the environment, and the ~126 tests
that drive real binaries then XCTSkip. The job goes green having tested none of
the Rust/Swift boundary -- which is how the `help.replacement` contract break
(#488) survived.

The iPad job already wraps both of its piped `xcodebuild` steps in
`set -o pipefail`; these three were the ones that missed it.

Expect the mac job to go red until those 7 are fixed. That is the point.

Implementation-Agent: orchestrator-astra
Commit-Executor: orchestrator-astra (direct; Cursor usage limit)
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