Skip to content

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Dec 15, 2025

Summary of changes

Changes introduced in this pull request:

  • enable RPC snapshot tests in debug and codecov tests

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.

Summary by CodeRabbit

  • Chores

    • Improved build/test profiles to speed development builds and reduce debug output for dependencies.
    • Simplified CI coverage flow by routing coverage generation through a unified make target and centralizing environment configuration.
  • Tests

    • RPC regression tests now run consistently in CI.
    • Added test-only helpers to detect debug/CI environment to improve and standardize test behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Walkthrough

Consolidates coverage generation into a Makefile target and sets RUSTFLAGS in CI, adjusts dev-profile optimization/debug settings in Cargo manifests, removes a CI debug-build skip so RPC snapshot tests run on CI, and adds two test-scoped helpers to detect debug/CI environment.

Changes

Cohort / File(s) Summary
CI coverage workflow
\.github/workflows/coverage.yml, Makefile
CI now sets RUSTFLAGS and invokes make codecov instead of running cargo llvm-cov inline; Makefile adds a codecov target that runs cargo llvm-cov --workspace --codecov --output-path lcov.info --ignore-run-fail.
Workspace / dev profiles
Cargo.toml, interop-tests/Cargo.toml
Root Cargo.toml adds opt-level = 1 under [profile.dev.package."*"]. interop-tests/Cargo.toml adds [profile.dev] with debug = "line-tables-only" and split-debuginfo = "unpacked", plus per-package [profile.dev.package."*"] (disable dependency debug, opt-level = 1) and a forest-filecoin package override (opt-level = 0, keep line-tables-only/unpacked).
RPC snapshot tests
src/tool/subcommands/api_cmd/test_snapshot.rs
Removed the conditional that skipped rpc_regression_test_run on CI debug builds so the snapshot-based RPC test runs unconditionally on CI and locally.
Test helpers
src/utils/mod.rs
Added test-scoped helpers pub fn is_debug_build() -> bool and pub fn is_ci() -> bool, both #[cfg(test)] and #[allow(dead_code)] (returning cfg!(debug_assertions) and misc::env::is_env_truthy("CI"), respectively).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Potential focal points:

  • src/tool/subcommands/api_cmd/test_snapshot.rs: confirm tests and proof downloads are stable on CI and won't introduce flakiness or long runtime.
  • .github/workflows/coverage.yml & Makefile: verify RUSTFLAGS and make codecov produce valid coverage artifacts on CI runners.
  • Cargo.toml / interop-tests/Cargo.toml: ensure profile changes (opt-level, split-debuginfo) don't break local debugging, test determinism, or build artifacts.

Possibly related PRs

Suggested reviewers

  • LesnyRumcajs
  • akaladarshi

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: optimizing test performance through build profile adjustments, workflow changes, and enabling snapshot tests in debug/codecov scenarios.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hm/speed-up-debug-tests

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f739c0c and 63faa31.

📒 Files selected for processing (1)
  • .github/workflows/coverage.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/coverage.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build MacOS
  • GitHub Check: Coverage
  • GitHub Check: All lint checks
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: tests-release
  • GitHub Check: tests

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

@hanabi1224 hanabi1224 marked this pull request as ready for review December 15, 2025 08:55
@hanabi1224 hanabi1224 requested a review from a team as a code owner December 15, 2025 08:55
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and akaladarshi and removed request for a team December 15, 2025 08:55
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/utils/mod.rs (1)

172-183: Remove is_debug_build() or integrate it if intentional.

The is_debug_build() function at line 173-176 is not used anywhere in the codebase. The is_ci() function is actually used in src/tool/subcommands/api_cmd/test_snapshot.rs:220, so the #[allow(dead_code)] on it is unnecessary. Either remove is_debug_build() if it's not needed, or remove the #[allow(dead_code)] from is_ci() since it serves a real purpose.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 58352c4 and 3896d32.

📒 Files selected for processing (6)
  • .github/workflows/coverage.yml (2 hunks)
  • Cargo.toml (1 hunks)
  • Makefile (1 hunks)
  • interop-tests/Cargo.toml (1 hunks)
  • src/tool/subcommands/api_cmd/test_snapshot.rs (0 hunks)
  • src/utils/mod.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • src/tool/subcommands/api_cmd/test_snapshot.rs
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
📚 Learning: 2025-08-07T13:39:36.962Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: interop-tests/src/tests/go_app/gen.go:88-90
Timestamp: 2025-08-07T13:39:36.962Z
Learning: Skip reviewing auto-generated files marked with "Generated by rust2go. Please DO NOT edit this C part manually." as these should not be manually edited and any issues should be addressed in the code generation tool or source templates instead.

Applied to files:

  • interop-tests/Cargo.toml
📚 Learning: 2025-08-08T12:10:45.218Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5867
File: src/ipld/util.rs:553-558
Timestamp: 2025-08-08T12:10:45.218Z
Learning: Forest pins Rust toolchain to 1.89.0 via rust-toolchain.toml; features stabilized in 1.88 (e.g., let-chains) are acceptable in this codebase.

Applied to files:

  • interop-tests/Cargo.toml
📚 Learning: 2025-08-07T13:39:15.107Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: interop-tests/src/tests/go_app/gen.go:29-29
Timestamp: 2025-08-07T13:39:15.107Z
Learning: Auto-generated files like those created by rust2go (indicated by "Generated by rust2go. Please DO NOT edit this C part manually." comment) in the Forest project should be skipped during code review as they are not intended for manual editing.

Applied to files:

  • interop-tests/Cargo.toml
📚 Learning: 2025-08-08T12:10:45.218Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5867
File: src/ipld/util.rs:553-558
Timestamp: 2025-08-08T12:10:45.218Z
Learning: Forest project targets Rust stable >=1.89; features stabilized in 1.88 like let-chains are acceptable in this codebase.

Applied to files:

  • interop-tests/Cargo.toml
📚 Learning: 2025-09-11T16:03:14.328Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 6000
File: src/tool/subcommands/api_cmd/state_decode_params_tests/miner.rs:4-9
Timestamp: 2025-09-11T16:03:14.328Z
Learning: In the Forest codebase's state_decode_params_tests module, common imports like `to_vec`, `TokenAmount`, `Cid`, etc. are centralized in the mod.rs file and made available to submodules through `use super::*;`, eliminating the need for duplicate imports in individual test files.

Applied to files:

  • src/utils/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Coverage
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: Build MacOS
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: All lint checks
🔇 Additional comments (4)
interop-tests/Cargo.toml (1)

44-54: LGTM! Profile optimizations mirror the main Cargo.toml.

The dev profile configuration reduces debug info overhead (line-tables-only, debug = false for dependencies) and enables opt-level = 1 for dependencies to speed up test execution. These settings align with Cargo's recommended build performance optimizations.

Cargo.toml (1)

271-275: LGTM! Adding opt-level = 1 for dependencies is a sensible trade-off.

This enables basic optimizations for dependencies while keeping the main crate unoptimized for fast compilation and debuggability. This should noticeably speed up test execution, especially for compute-heavy tests.

.github/workflows/coverage.yml (2)

34-35: LGTM! Linker optimization should speed up builds.

Using clang with lld is a well-known technique for faster link times. The Ubuntu 22.04 runner includes both by default.


54-55: LGTM! Clean delegation to Makefile target.

Centralizing the coverage command in the Makefile improves maintainability and allows local reproduction of CI coverage runs.

Makefile Outdated
Comment on lines 113 to 114
codecov:
cargo llvm-cov --workspace --codecov --output-path lcov.info
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

cargo llvm-cov --codecov flag output format

💡 Result:

The --codecov flag makes cargo-llvm-cov export llvm-cov's JSON and convert it into Codecov's "custom coverage" JSON (a codecov.json file containing region/branch-aware coverage data suitable for the Codecov uploader). See the cargo-llvm-cov docs and repo README. [1][2]

Sources:

  • cargo-llvm-cov README/docs (explains --codecov uses llvm-cov JSON then converts to codecov.json). [1]
  • cargo-llvm-cov crate docs (details on JSON/Codecov output). [2]

🌐 Web query:

codecov-action lcov.info format support

💡 Result:

Yes. The Codecov GitHub Action will upload LCOV reports (lcov.info) to Codecov, and Codecov accepts LCOV (.info/.txt) format for processing. [1][2]

Sources:

  • Codecov supported report formats (includes LcovProcessor). [1]
  • codecov/codecov-action repository / Marketplace (uploader action used with GitHub Actions). [2]

Align the output filename with the actual coverage format.

The --codecov flag outputs Codecov's custom JSON format, but the filename lcov.info implies LCOV format, creating unnecessary confusion. Either rename to codecov.json to match the actual output format, or switch to --lcov and use lcov.info for actual LCOV format output.

🤖 Prompt for AI Agents
In Makefile around lines 113 to 114, the target writes Codecov JSON but names
the file lcov.info; change the output to a matching filename or change the flag.
Either rename the output to codecov.json (update the target to write to
codecov.json) or replace --codecov with --lcov so lcov.info is actually LCOV;
update any references elsewhere (CI, upload steps) to the new filename
accordingly.

@hanabi1224 hanabi1224 force-pushed the hm/speed-up-debug-tests branch from 3896d32 to 9fe52dd Compare December 15, 2025 09:01
@hanabi1224 hanabi1224 force-pushed the hm/speed-up-debug-tests branch from 9fe52dd to 41ddefc Compare December 15, 2025 09:31
Copy link
Member

Choose a reason for hiding this comment

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

nice

Copy link
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

As discussed, the debug tests are kind of doing the same as coverage tests, so let's get rid of the former in a follow-up PR.

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Dec 16, 2025
Merged via the queue into main with commit 08b2e2c Dec 16, 2025
45 checks passed
@LesnyRumcajs LesnyRumcajs deleted the hm/speed-up-debug-tests branch December 16, 2025 15:07
@coderabbitai coderabbitai bot mentioned this pull request Dec 16, 2025
4 tasks
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