Skip to content

fix(runs): make TestWatchActionUpdates_OnlyStreamsTargetAction deterministic#7231

Merged
SVilgelm merged 2 commits intov2from
svilgelm/fix-flaky-watch-action-test
Apr 17, 2026
Merged

fix(runs): make TestWatchActionUpdates_OnlyStreamsTargetAction deterministic#7231
SVilgelm merged 2 commits intov2from
svilgelm/fix-flaky-watch-action-test

Conversation

@SVilgelm
Copy link
Copy Markdown

@SVilgelm SVilgelm commented Apr 17, 2026

Summary

  • Fix flaky TestWatchActionUpdates_OnlyStreamsTargetAction test
  • The test was racy: CreateAction("target") sends a PostgreSQL NOTIFY that could arrive after the watcher subscribed, causing a spurious "unexpected update for action target" failure
  • Fix: start the watcher before creating actions and deterministically drain the creation notification before assertions

Test plan

  • CI passes consistently (test was intermittently failing before)

🤖 Generated with Claude Code

  • main
    • Flyte 2 #6583
      • fix(runs): make TestWatchActionUpdates_OnlyStreamsTargetAction deterministic 👈

…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>
Copilot AI review requested due to automatic review settings April 17, 2026 16:10
@github-actions github-actions bot mentioned this pull request Apr 17, 2026
3 tasks
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WatchActionUpdates goroutine 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.

Comment thread runs/repository/impl/action_test.go Outdated
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>
@SVilgelm SVilgelm merged commit ae0580f into v2 Apr 17, 2026
20 checks passed
@SVilgelm SVilgelm deleted the svilgelm/fix-flaky-watch-action-test branch April 17, 2026 17:22
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.

3 participants