Deflake TestWorkflowEngine_ParallelExecution - #6112
Merged
Merged
Conversation
The test asserted maxConcurrent >= 2 to prove the two independent level-1 steps run in parallel, but that counter only reaches 2 when the two 50ms mock sleeps overlap in wall-clock time. On a loaded CI runner the second goroutine can be starved and start only after the first already finished, leaving maxConcurrent at 1 and failing the test regardless of the diff under test. This flaked the unit-test job on main (previously "deflaked" in #4333, which only reduced but did not remove the timing dependence). Replace the sleeps with a rendezvous barrier: each fetch step blocks on entry until both have arrived, so neither can complete until the other has started. This makes the concurrency assertion deterministic under any scheduler load, and turns a genuine regression to sequential execution into a clear timeout failure instead of a lucky pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChrisJBurns
requested review from
JAORMX,
amirejaz,
jerm-dro,
jhrozek and
tgrunnagle
as code owners
July 28, 2026 15:18
jhrozek
approved these changes
Jul 28, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6112 +/- ##
==========================================
- Coverage 72.43% 72.42% -0.02%
==========================================
Files 734 733 -1
Lines 75871 75833 -38
==========================================
- Hits 54960 54924 -36
+ Misses 17019 17014 -5
- Partials 3892 3895 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
TestWorkflowEngine_ParallelExecutionfailed the unit-test job onmain(e.g. commit2858ac8c3) with:Why: The test proves the two independent level-1 steps run in parallel by asserting
maxConcurrent >= 2. That counter only reaches 2 if the two 50ms mock sleeps overlap in wall-clock time. On a loaded CI runner the second goroutine can be starved and start only after the first has already finished its sleep, leavingmaxConcurrent == 1— so the test fails regardless of the change under test. The failure is unrelated to the commit it landed on (that PR does not touchpkg/vmcp/composer). This test was previously "deflaked" in #4333, which reduced but did not remove the timing dependence.What: Replaces the sleeps with a rendezvous barrier — each fetch step blocks on entry until both have arrived, so neither can complete until the other has started. The concurrency assertion is now deterministic under any scheduler load. As a bonus, a genuine regression to sequential execution now surfaces as a clear timeout failure instead of a lucky pass. The engine already runs level steps in parallel via
errgroup+ a size-10 semaphore, so a barrier of 2 is always satisfiable.Type of change
Test plan
go test ./pkg/vmcp/composer/ -run TestWorkflowEngine_ParallelExecution -race -count=30— all pass, no races.pkg/vmcp/composerpackage with-race— green.Does this introduce a user-facing change?
No.
Generated with Claude Code