Skip to content

[DX-3769] [CRE-1561] Fix found flakes#22133

Closed
kalverra wants to merge 1 commit intodevelopfrom
fixFlakeExperiment
Closed

[DX-3769] [CRE-1561] Fix found flakes#22133
kalverra wants to merge 1 commit intodevelopfrom
fixFlakeExperiment

Conversation

@kalverra
Copy link
Copy Markdown
Collaborator

I tested out the ai skil at #22125 in some simple cases. It found and fixed 2 flakes:

  • TestFluxMonitor_HibernationMode (CRE-1561)
  • TestVRFV2PlusIntegration_SingleConsumer_EIP150_HappyPath

Copilot AI review requested due to automatic review settings April 22, 2026 15:41
@kalverra kalverra requested review from a team as code owners April 22, 2026 15:41
@github-actions
Copy link
Copy Markdown
Contributor

👋 kalverra, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

Copy link
Copy Markdown
Contributor

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

Risk Rating: LOW (test-only changes; no production logic touched)

Fixes two flaky integration tests by adding retry logic around EVM log filtering where the simulated backend may not surface events immediately.

Changes:

  • Add require.Eventually retry loop when filtering RandomWordsRequested logs in VRF v2 integration helper logic.
  • Replace a gomega.Eventually(...).Should(Equal(...)) assertion with require.Eventually in Flux Monitor hibernation mode integration test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
core/services/vrf/v2/integration_v2_test.go Retry log filtering for RandomWordsRequested to reduce flakiness on simulated backend.
core/services/fluxmonitorv2/integrations_test.go Use require.Eventually to retry reading FlagRaised logs to reduce flakiness.

Comment on lines +722 to +726
require.Eventually(t, func() bool {
iter, err := coordinator.FilterRandomWordsRequested(nil, nil, []*big.Int{subID}, nil)
if err != nil {
return false
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

FilterRandomWordsRequested returns a RandomWordsRequestedIterator with a Close() method; inside this require.Eventually loop a new iterator is created on each poll but never closed. This can leak resources/goroutines across retries and make the test flaky. Ensure the iterator is closed on every attempt (including early-return paths), and handle any Close() error appropriately.

Suggested change
require.Eventually(t, func() bool {
iter, err := coordinator.FilterRandomWordsRequested(nil, nil, []*big.Int{subID}, nil)
if err != nil {
return false
}
require.Eventually(t, func() (ok bool) {
iter, err := coordinator.FilterRandomWordsRequested(nil, nil, []*big.Int{subID}, nil)
if err != nil {
return false
}
defer func() {
if closeErr := iter.Close(); closeErr != nil {
t.Logf("failed to close RandomWordsRequested iterator: %v", closeErr)
ok = false
}
}()

Copilot uses AI. Check for mistakes.
var batch []v22.RandomWordsRequested
for iter.Next() {
batch = append(batch, iter.Event())
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The iterator's Error() is not checked after the for iter.Next() loop. If iteration stops due to an underlying error, this code can accept a partial batch and proceed as though it succeeded. Check iter.Error() (and treat non-nil as a failed attempt) before assigning events / returning true.

Suggested change
}
}
if err := iter.Error(); err != nil {
return false
}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah true error check was missing

@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Apr 22, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@cl-sonarqube-production
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube IDE SonarQube IDE

@sebawo sebawo requested a review from Fletch153 April 23, 2026 14:43
@kalverra
Copy link
Copy Markdown
Collaborator Author

kalverra commented May 7, 2026

Closed in favor of #22324

@kalverra kalverra closed this May 7, 2026
@kalverra kalverra deleted the fixFlakeExperiment branch May 7, 2026 18:16
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