-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(explore): Fix flaky virtual streaming test assertions #114928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ryan953
wants to merge
1
commit into
master
Choose a base branch
from
ryan953/fix/flaky-virtual-streaming-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: A race condition in a test can cause intermittent failures because an assertion runs before a
useEffecthas initialized thevirtualStreamedTimestampstate.Severity: LOW
Suggested Fix
Wrap the failing assertion,
expect(result.current.data).toHaveLength(3), inside awaitFor()utility. This will ensure the test retries the assertion until theuseEffecthas run and the component state has been correctly updated.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cursor can you fix this?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, I can see these tests don't use virtual streaming (the wrapper doesn't enable auto refresh), so they shouldn't have the same race condition. The fix that's already been committed addresses the issue correctly. Let me check the PR to see if there are any additional concerns from the bot:
Based on my analysis:
waitFor(), which is exactly what the bot suggestedwaitFor()block, suggesting the bot's analysis may have been done before or during the fixwaitFor()waitFor()don't use virtual streaming (they useautoRefresh: 'idle'), so they don't have the same race conditionThe issue has been properly resolved. The fix correctly addresses the race condition where
virtualStreamedTimestampis initialized inside auseEffect, causing a brief render whereisPendingis false but the virtual streaming filter isn't active yet.Summary
The race condition issue identified by the Sentry bot has already been fixed in commit
051ae3fe3a3. The fix properly wraps the flaky assertions inwaitFor()to wait for theuseEffectthat initializesvirtualStreamedTimestampto complete before validating the filtered results.The two affected tests now correctly handle the async state initialization:
No additional changes are needed. The bot comment appears to be referencing the code state before the fix was applied, or there's a delay in the bot's comment processing.