Skip to content

Fix ARM64 CI flaky test output ordering#16

Open
zyla wants to merge 1 commit intomainfrom
fix/arm64-flaky-test-output-ordering
Open

Fix ARM64 CI flaky test output ordering#16
zyla wants to merge 1 commit intomainfrom
fix/arm64-flaky-test-output-ordering

Conversation

@zyla
Copy link
Collaborator

@zyla zyla commented Mar 12, 2026

Summary

  • Move stream handler waits (stdout/stderr) to before status logging in src/App.hs, ensuring all subprocess output is fully flushed before "success" or "skipped" messages are written
  • Fixes a race condition where the main thread could log status messages before output handler asyncs finished reading subprocess output, causing non-deterministic line ordering visible in golden tests on ARM64

Root Cause

After waitForProcess returns, the main thread immediately writes status messages (e.g. logInfo "success") via toplevelStderr. However, the stdoutHandler async (reading subprocess stdout via toplevelStdout) was only awaited later. Both handles write to the same merged pipe in test mode, so on ARM64 (with different scheduler behavior) the status message could appear before the last subprocess output line.

Test plan

  • All 34 tests pass with SKIP_SLOW_TESTS=1 SKIP_S3_TESTS=1 stack test
  • Verify ARM64 CI no longer produces flaky golden test failures

🤖 Generated with Claude Code

Move stream handler waits (stdout/stderr) to before status logging,
ensuring all subprocess output is fully flushed before "success" or
"skipped" messages are written. This eliminates a race condition where
the main thread could write status messages before the output handler
asyncs finished reading subprocess output.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
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