Skip to content

fix(ci): speed up wallet tests on CI#7218

Open
hanabi1224 wants to merge 1 commit into
mainfrom
hm/ci-speed-up-wallet-tests
Open

fix(ci): speed up wallet tests on CI#7218
hanabi1224 wants to merge 1 commit into
mainfrom
hm/ci-speed-up-wallet-tests

Conversation

@hanabi1224

@hanabi1224 hanabi1224 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

This PR attempts to speed up wallet CI tests, as they cannot run in parallel for multiple PRs

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • New Features

    • Added a tests subcommand to run Calibnet integration tests from the command line, including wallet and mpool scenarios.
  • Chores

    • Unified wallet and mpool Calibnet integration tests under a command-driven libtest_mimic harness.
    • Updated local test tasks to use forest-dev tests calibnet for wallet and mpool.
    • Updated CI to include the ready_for_review trigger and to skip the wallet check job for draft pull requests.
    • Adjusted Cargo feature/dependency and removed now-obsolete test targets.

@hanabi1224 hanabi1224 marked this pull request as ready for review June 22, 2026 14:24
@hanabi1224 hanabi1224 requested a review from a team as a code owner June 22, 2026 14:24
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and sudo-shashank and removed request for a team June 22, 2026 14:24
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Removes the calibnet-integration cargo feature and its two test binary targets, replacing them with a forest-dev tests calibnet CLI subcommand hierarchy backed by libtest_mimic. Calibnet mpool and wallet async test functions are converted from attribute-driven tests to named trials invoked through the new harness. CI gating prevents calibnet checks on draft PRs, and spell-check dictionaries are updated.

Changes

Calibnet Test Migration to CLI Subcommand

Layer / File(s) Summary
Cargo manifest cleanup and CI draft gate
Cargo.toml, .github/workflows/forest.yml
Removes calibnet-integration feature and [[test]] targets for mpool_tools and wallet, adds libtest-mimic = "0.8" as an optional dependency, adds a draft-PR skip condition to calibnet-wallet-check, and includes ready_for_review in pull request trigger event types.
New forest-dev tests subcommand hierarchy
src/dev/subcommands/mod.rs, src/dev/subcommands/tests_cmd.rs, src/dev/subcommands/tests_cmd/calibnet.rs
Registers the Tests variant in the dev Subcommand enum and wires its run dispatch; introduces TestsCommandCalibnetTestsCommandWallet/Mpool clap subcommand chain that orchestrates test execution through the new CLI entry point.
Test harness infrastructure and mise task update
src/dev/subcommands/tests_cmd/calibnet/helpers.rs, mise.toml
Adds a block_on helper to synchronously execute async test functions within the libtest_mimic trial harness context. Updates the mise.toml test:wallet task to invoke forest-dev tests calibnet mpool and forest-dev tests calibnet wallet instead of direct cargo test invocations.
Mpool tests converted to libtest_mimic trials
src/dev/subcommands/tests_cmd/calibnet/mpool.rs
Introduces CalibnetMpoolTestCommand::run that configures libtest_mimic::Arguments and executes a tests() suite; wraps two async mpool functions as named Trials via block_on. Removes #[tokio::test] and #[serial] attributes from test functions.
Wallet tests converted to libtest_mimic trials
src/dev/subcommands/tests_cmd/calibnet/wallet.rs
Replaces rstest and #[tokio::test] attribute-driven setup with CalibnetWalletTestCommand and a tests() trial-registration function. Converts six wallet test scenarios (market_add_balance_message_on_chain, send_to_filecoin_address, send_to_eth_equivalent, wallet_delete, delegated_send, delegated_remote_send) from attribute-driven tests into plain async fns driven by the libtest_mimic harness.
Spell-check dictionary updates
.config/forest.dic
Updates the dictionary header count from 274 to 276 and adds entries for mpool and nonces to support the new CLI terminology and test naming.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ChainSafe/forest#6544: Both PRs update .github/workflows/forest.yml to add job-level gating on github.event.pull_request.draft == false to prevent Calibnet-related CI jobs from running on draft pull requests.

  • ChainSafe/forest#6372: Both PRs modify src/dev/subcommands/mod.rs by extending the Subcommand enum and its Subcommand::run dispatch logic to support new subcommand variants.

  • ChainSafe/forest#6983: Both PRs modify the Calibnet wallet test execution path, particularly mise.toml's tasks."test:wallet" configuration for integrating Calibnet wallet tests into the development workflow.

Suggested reviewers

  • sudo-shashank
  • LesnyRumcajs
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main objective: refactoring wallet tests to use a CLI-based test harness (libtest_mimic) instead of attribute-driven tests, which speeds up CI execution.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hm/ci-speed-up-wallet-tests
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch hm/ci-speed-up-wallet-tests

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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/dev/subcommands/tests_cmd.rs (1)

14-17: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Add command-level error context in the dispatcher.

Line 16 currently forwards errors directly; adding .context(...) will make CLI failures easier to diagnose upstream.

Proposed change
+use anyhow::Context as _;
+
 impl TestsCommand {
     pub async fn run(self) -> anyhow::Result<()> {
         match self {
-            Self::Calibnet(cmd) => cmd.run().await,
+            Self::Calibnet(cmd) => cmd.run().await.context("running tests calibnet subcommand"),
         }
     }
 }

As per coding guidelines, **/*.rs: "Use anyhow::Result<T> for most operations and add context with .context() when errors occur".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/dev/subcommands/tests_cmd.rs` around lines 14 - 17, The run method in the
dispatcher is not adding error context when forwarding the result from
cmd.run().await for the Calibnet variant. Add an anyhow context message using
.context() after the cmd.run().await call to provide diagnostic information
about what command failed, making the error easier to diagnose upstream when it
propagates to the CLI level.

Source: Coding guidelines

src/dev/subcommands/tests_cmd/calibnet.rs (1)

16-20: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Wrap nested command failures with calibnet-specific context.

Lines 18-19 should attach context so wallet vs mpool failures are immediately distinguishable in the error chain.

Proposed change
+use anyhow::Context as _;
+
 impl CalibnetTestsCommand {
     pub async fn run(self) -> anyhow::Result<()> {
         match self {
-            Self::Wallet(cmd) => cmd.run().await,
-            Self::Mpool(cmd) => cmd.run().await,
+            Self::Wallet(cmd) => cmd.run().await.context("running calibnet wallet tests"),
+            Self::Mpool(cmd) => cmd.run().await.context("running calibnet mpool tests"),
         }
     }
 }

As per coding guidelines, **/*.rs: "Use anyhow::Result<T> for most operations and add context with .context() when errors occur".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/dev/subcommands/tests_cmd/calibnet.rs` around lines 16 - 20, The run
method in the calibnet command handler does not attach context to errors from
nested wallet and mpool commands, making it difficult to distinguish which
subcommand failed. Wrap both cmd.run().await calls (for Self::Wallet and
Self::Mpool branches) with .context() calls that provide calibnet-specific
context identifying which command failed, such as "wallet command failed" and
"mpool command failed" respectively, so that errors in the chain are immediately
distinguishable.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/forest.yml:
- Line 229: The GitHub workflow is missing the `ready_for_review` event type in
its pull request trigger configuration, preventing the workflow from re-running
when a draft PR transitions to ready status. Locate the workflow trigger
definition (around line 18) where the pull request event types are specified,
and add `ready_for_review` to the `types:` array alongside the existing event
types. This ensures that the `calibnet-wallet-check` job, which properly checks
`github.event.pull_request.draft == false` at line 229, will execute when drafts
are marked ready without requiring an additional commit.

In `@src/dev/subcommands/tests_cmd/calibnet/mpool.rs`:
- Around line 10-35: The test closures in the tests() function are using
futures::executor::block_on to execute async test functions, but these functions
internally call helpers that depend on Tokio runtime operations like
tokio::time::sleep and tokio::time::Instant::now, which fail without a Tokio
runtime context. Replace the futures::executor::block_on call with
tokio::runtime::Runtime::new()?.block_on() to provide the necessary Tokio
runtime context for all test trials (both in the Trial::test closures for
mpool_nonce_fix_auto_unblocks_pending and mpool_replace_auto_unblocks_pending,
and similarly for other test functions).

---

Nitpick comments:
In `@src/dev/subcommands/tests_cmd.rs`:
- Around line 14-17: The run method in the dispatcher is not adding error
context when forwarding the result from cmd.run().await for the Calibnet
variant. Add an anyhow context message using .context() after the
cmd.run().await call to provide diagnostic information about what command
failed, making the error easier to diagnose upstream when it propagates to the
CLI level.

In `@src/dev/subcommands/tests_cmd/calibnet.rs`:
- Around line 16-20: The run method in the calibnet command handler does not
attach context to errors from nested wallet and mpool commands, making it
difficult to distinguish which subcommand failed. Wrap both cmd.run().await
calls (for Self::Wallet and Self::Mpool branches) with .context() calls that
provide calibnet-specific context identifying which command failed, such as
"wallet command failed" and "mpool command failed" respectively, so that errors
in the chain are immediately distinguishable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 51272f9c-a2ee-4b20-8bea-14b273c0843d

📥 Commits

Reviewing files that changed from the base of the PR and between f9febda and 8a92440.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • .github/workflows/forest.yml
  • Cargo.toml
  • mise.toml
  • src/dev/subcommands/mod.rs
  • src/dev/subcommands/tests_cmd.rs
  • src/dev/subcommands/tests_cmd/calibnet.rs
  • src/dev/subcommands/tests_cmd/calibnet/helpers.rs
  • src/dev/subcommands/tests_cmd/calibnet/mpool.rs
  • src/dev/subcommands/tests_cmd/calibnet/wallet.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)

Comment thread .github/workflows/forest.yml
Comment thread src/dev/subcommands/tests_cmd/calibnet/mpool.rs Outdated
@hanabi1224 hanabi1224 force-pushed the hm/ci-speed-up-wallet-tests branch from 8a92440 to 085a8ee Compare June 22, 2026 15:12

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/dev/subcommands/tests_cmd/calibnet/helpers.rs`:
- Around line 382-384: The block_on helper function uses Handle::current() which
can panic if tokio runtime context is not available in the test closure. Replace
the Handle::current() call with try_current() and propagate any error using
anyhow::Result and .context() for clear error messaging. This ensures the
function fails gracefully with a descriptive error message rather than panicking
when runtime context is unavailable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c6512da0-f78e-4a00-b085-b4c1abedb682

📥 Commits

Reviewing files that changed from the base of the PR and between 8a92440 and 085a8ee.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • .config/forest.dic
  • .github/workflows/forest.yml
  • Cargo.toml
  • mise.toml
  • src/dev/subcommands/mod.rs
  • src/dev/subcommands/tests_cmd.rs
  • src/dev/subcommands/tests_cmd/calibnet.rs
  • src/dev/subcommands/tests_cmd/calibnet/helpers.rs
  • src/dev/subcommands/tests_cmd/calibnet/mpool.rs
  • src/dev/subcommands/tests_cmd/calibnet/wallet.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • filecoin-project/lotus (manual)
✅ Files skipped from review due to trivial changes (1)
  • .config/forest.dic
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/dev/subcommands/tests_cmd/calibnet.rs
  • src/dev/subcommands/mod.rs
  • .github/workflows/forest.yml
  • mise.toml
  • src/dev/subcommands/tests_cmd.rs
  • src/dev/subcommands/tests_cmd/calibnet/mpool.rs
  • Cargo.toml
  • src/dev/subcommands/tests_cmd/calibnet/wallet.rs

Comment thread src/dev/subcommands/tests_cmd/calibnet/helpers.rs Outdated
@hanabi1224 hanabi1224 force-pushed the hm/ci-speed-up-wallet-tests branch from 085a8ee to 37ce48d Compare June 22, 2026 15:18
@hanabi1224 hanabi1224 force-pushed the hm/ci-speed-up-wallet-tests branch from 37ce48d to ccb8b78 Compare June 22, 2026 15:30
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 96 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.01%. Comparing base (8c8e717) to head (ccb8b78).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/dev/subcommands/tests_cmd/calibnet/wallet.rs 0.00% 63 Missing ⚠️
src/dev/subcommands/tests_cmd/calibnet/mpool.rs 0.00% 17 Missing ⚠️
src/dev/subcommands/tests_cmd/calibnet/helpers.rs 0.00% 6 Missing ⚠️
src/dev/subcommands/tests_cmd/calibnet.rs 0.00% 5 Missing ⚠️
src/dev/subcommands/tests_cmd.rs 0.00% 4 Missing ⚠️
src/dev/subcommands/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/dev/subcommands/mod.rs 72.46% <0.00%> (-1.07%) ⬇️
src/dev/subcommands/tests_cmd.rs 0.00% <0.00%> (ø)
src/dev/subcommands/tests_cmd/calibnet.rs 0.00% <0.00%> (ø)
src/dev/subcommands/tests_cmd/calibnet/helpers.rs 0.00% <0.00%> (ø)
src/dev/subcommands/tests_cmd/calibnet/mpool.rs 0.00% <0.00%> (ø)
src/dev/subcommands/tests_cmd/calibnet/wallet.rs 0.00% <0.00%> (ø)

... and 15 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c8e717...ccb8b78. Read the comment docs.

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

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