fix(runs): make TestWatchActionUpdates_OnlyStreamsTargetAction deterministic#7231
Merged
fix(runs): make TestWatchActionUpdates_OnlyStreamsTargetAction deterministic#7231
Conversation
…inistic Start watcher before creating actions so the subscriber is registered when the creation NOTIFY arrives. Drain the creation notification before the real assertions to eliminate the race that caused spurious "unexpected update for action target" failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sergey Vilgelm <sergey@union.ai>
There was a problem hiding this comment.
Pull request overview
Fixes flakiness in TestWatchActionUpdates_OnlyStreamsTargetAction by ensuring the watcher is started before action creation and by explicitly draining the initial creation notification before running assertions.
Changes:
- Start
WatchActionUpdatesgoroutine before creating actions to avoid missing the creation NOTIFY. - Drain the initial “action created” update for the target action before performing update assertions.
- Reduce the initial wait from ~1.1s to 100ms.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace time.Sleep with require.Eventually polling actionSubscribers to ensure the watcher is registered before creating actions. This removes all timing dependencies from the test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sergey Vilgelm <sergey@union.ai>
kumare3
approved these changes
Apr 17, 2026
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
TestWatchActionUpdates_OnlyStreamsTargetActiontestCreateAction("target")sends a PostgreSQL NOTIFY that could arrive after the watcher subscribed, causing a spurious "unexpected update for action target" failureTest plan
🤖 Generated with Claude Code
main