Skip to content

test: wait for the workflow to settle before replaying a persisted signal - #29

Open
rgamba wants to merge 2 commits into
mainfrom
fix-replay-signal-test-race
Open

rgamba wants to merge 2 commits into
mainfrom
fix-replay-signal-test-race

Conversation

@rgamba

@rgamba rgamba commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the flake in SqliteWorkflowIntegTest > TestPersistedSignals > testReplaySignal_reusesSameRowAndDoesNotDuplicate, which failed with OptimisticLockingError at the replaySignal call on three of eight JVM matrix legs today, including two of four on the first main run after #28 (run 35024834524). With the jvm-build fan-in red, tag-release cannot run.

Cause

After a successful signal the engine writes the instance as RUNNING and schedules a re-run, which then writes it back to WAITING. The test waited only for the persisted-signal row to exist, which is already true the instant the signal executes, and then called replaySignal while that re-run was still in flight. Both paths write the instance, and the loser gets the optimistic-locking error. GitHub's runners hit the window far more often than CircleCI's did.

Fix

One added wait: helper.expectWorkflowToWait() between the signal and the replay. It waits for WAITING and then for the scheduler task to drain, so the replay starts against a settled instance. Test-only change; no production code touched.

Testing

  • SqliteWorkflowIntegTest run locally with --rerun; the replay test passes (0.2 s) alongside the rest of the class.
  • The four-leg Jackson matrix on this PR is the real evidence, since the race only surfaced on hosted runners.

…gnal

testReplaySignal_reusesSameRowAndDoesNotDuplicate waited only for the
persisted-signal row to appear before calling replaySignal. A successful
signal writes the instance as RUNNING and schedules a re-run that writes it
back to WAITING, so the replay raced that re-run's write and failed with
OptimisticLockingError. On GitHub-hosted runners the race hit three of eight
matrix legs in a day, blocking the jvm-build fan-in on main.

expectWorkflowToWait() waits for WAITING and then for the scheduler task to
drain, which is exactly the settle the replay needs.
@rgamba
rgamba marked this pull request as ready for review September 15, 2026 23:28
@rgamba
rgamba force-pushed the fix-replay-signal-test-race branch from 8931d6b to 7171637 Compare September 15, 2026 23:39

This branch has not been deployed

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