Skip to content

Comments

✅ server: fix flaky nonce increment test isolation#763

Merged
cruzdanilo merged 2 commits intomainfrom
flaky
Feb 12, 2026
Merged

✅ server: fix flaky nonce increment test isolation#763
cruzdanilo merged 2 commits intomainfrom
flaky

Conversation

@cruzdanilo
Copy link
Member

@cruzdanilo cruzdanilo commented Feb 12, 2026


Open with Devin

Summary by CodeRabbit

  • Tests
    • Updated test verification mechanisms for transaction handling and error validation.

@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 5ce069f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link

Summary of Changes

Hello @cruzdanilo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses flakiness in a test related to nonce incrementation by improving its verification mechanism and isolation. The changes ensure that the nonce is correctly incremented and that exception capturing is asserted precisely within the test's scope, leading to a more stable and reliable test suite.

Highlights

  • Test Refactoring: Refactored the 'increments nonce' test in block.test.ts to directly verify the nonce value using publicClient.readContract, providing a more robust and reliable assertion mechanism.
  • Improved Test Isolation: Enhanced the assertion for captureException calls to ensure better test isolation by only checking exceptions captured during the specific test run, preventing interference from previous test executions.
  • Code Simplification: Simplified the log structure within the mock block data for improved readability and conciseness in the test.
Changelog
  • server/test/hooks/block.test.ts
    • Updated the 'increments nonce' test to use publicClient.readContract for direct nonce verification.
    • Modified captureException assertion to account for calls made specifically within the test's execution.
    • Streamlined the mock logs array in the test data.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

Warning

Rate limit exceeded

@cruzdanilo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 6 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

Modifications to a test file that replace transaction receipt-based completion checks with nonce-based readiness verification using on-chain contract reads. Error verification shifted from transaction logs to captured exception inspection, and event block logs payload simplified in revert scenarios.

Changes

Cohort / File(s) Summary
Test Assertion Updates
server/test/hooks/block.test.ts
Replaces waitForTransactionReceipt calls with nonce-based readiness checks via publicClient.readContract. Changes error/content verification from assertion of transaction logs to inspection of captured exceptions. Adjusts event block logs from multi-entry to single-entry array in revert proposal path. Removes nonce extraction from transaction receipts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • nfmelendez
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically addresses the main change: fixing test isolation issues in a nonce increment test by replacing flaky transaction-based waits with more reliable nonce verification.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch flaky

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@sentry
Copy link

sentry bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.76%. Comparing base (dbaaa93) to head (5ce069f).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #763   +/-   ##
=======================================
  Coverage   67.76%   67.76%           
=======================================
  Files         206      206           
  Lines        6951     6951           
  Branches     2178     2178           
=======================================
  Hits         4710     4710           
  Misses       2050     2050           
  Partials      191      191           
Flag Coverage Δ
e2e 51.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses test flakiness by refactoring the nonce incrementation test. The new approach of directly querying the contract's state using publicClient.readContract within vi.waitUntil is more direct and reliable than the previous method of spying on waitForTransactionReceipt and parsing logs. Additionally, the improved isolation for captureException mock calls, by tracking calls made specifically within the test, is a great enhancement for test stability. The suggestion to make the assertion more precise has been retained as it aligns with best practices.

@cruzdanilo cruzdanilo merged commit 5ce069f into main Feb 12, 2026
15 checks passed
@cruzdanilo cruzdanilo deleted the flaky branch February 12, 2026 01:23
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