Skip to content

ci: lint test targets with clippy --all-targets - #4330

Merged
QuantumExplorer merged 1 commit into
v4.2-devfrom
claude/jovial-mclaren-b08db2
Aug 7, 2026
Merged

ci: lint test targets with clippy --all-targets#4330
QuantumExplorer merged 1 commit into
v4.2-devfrom
claude/jovial-mclaren-b08db2

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Aug 7, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Clippy never linted test code in CI. Both gates ran without --all-targets:

  • tests-rs-workspace.ymlcargo clippy --workspace --all-features --locked -- --no-deps -D warnings
  • tests-rs-wallet.yml — the same, scoped to the wallet crates + dependents

Without --all-targets clippy only sees the lib/bin targets, so lints inside #[cfg(test)] code merge unnoticed and only surface for whoever runs clippy locally. cargo clippy -p platform-wallet --all-targets --all-features -- -D warnings currently fails on v4.2-dev with 3 errors, none of which CI can see.

What was done?

CI

Added --all-targets to both clippy steps. The wallet fast path needed it too — it lints platform-wallet-ffi, so it carried the same blind spot.

Lints cleared

A full --workspace --all-targets --all-features sweep over all 46 members turned up 11 findings in 2 crates beyond the 3 that prompted this. All are in #[cfg(test)] code:

  • rs-platform-walletawait_holding_lock in recovery.rs; two useless_vec in withdrawal.rs (vec![…][…])
  • rs-platform-wallet-ffi — seven field_reassign_with_default in persistence.rs (PersistenceCallbacks::default() + field assignment → struct literal with ..Default::default()); two unnecessary_map_or (map_or(false, …)is_some_and); one unnecessary_get_then_check (get(&k).is_none()!contains_key(&k))
  • wasm-drive-verifyitems_after_test_module; mod tests moved below convert_proof_result_to_js

Note on the await_holding_lock fix

built_resume_rebroadcasts_original_and_typed_failures_do_not_broadcast already released its guard with an explicit drop(broadcast) before the awaits, so the guard was never live across them at runtime. The lint fires regardless because it reasons about the binding's scope, not its liveness — a let binding's scope runs to the end of its enclosing block whatever drop() does. Scoping the guard to a nested block ends it for real. No #[allow], no behavior change.

Everything outside the two workflow lines is test-only.

How Has This Been Tested?

No new tests — this fixes lints in existing ones. All commands below exited 0:

  • cargo clippy --workspace --all-targets --all-features --locked -- --no-deps -D warnings (the exact new CI command)
  • The new wallet fast-path command, with --all-targets
  • cargo clippy -p platform-wallet --all-targets --all-features -- -D warnings
  • cargo test -p platform-wallet --lib — 574 passed
  • cargo test -p platform-wallet-ffi --lib --all-features — 246 passed (--all-features so the shielded-gated test is included)
  • cargo test -p wasm-drive-verify --lib — 15 passed
  • cargo fmt --check --all

Each edited test was confirmed present in the runner output rather than filtered out.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Expanded automated linting to cover all package targets, including tests, benchmarks, and examples.
    • Updated test implementations and organization without changing expected behavior or assertions.
  • Refactor

    • Simplified test setup and modernized collection and option checks for clearer, more maintainable test code.

Both clippy steps ran without `--all-targets`, so clippy only ever saw
the lib/bin targets. Lints in `#[cfg(test)]` code merged unnoticed and
surfaced only for whoever ran clippy locally.

Add `--all-targets` to the workspace step and to the wallet fast path
(which lints platform-wallet-ffi, so it had the same blind spot), then
clear the backlog that exposes:

- platform-wallet: `await_holding_lock` in the asset-lock recovery test,
  two `useless_vec` in the masternode withdrawal tests.
- platform-wallet-ffi: seven `field_reassign_with_default`, two
  `unnecessary_map_or`, one `unnecessary_get_then_check`.
- wasm-drive-verify: `items_after_test_module`.

The `await_holding_lock` site already dropped its guard before the
awaits. The lint fires anyway because it reasons about the binding's
scope rather than its liveness, so an explicit `drop()` does not clear
it; scoping the guard to a nested block does, with no behavior change.

Everything outside the two workflow lines is test-only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v4.2.0 milestone Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e294544a-8f76-4096-91cb-e00813c1b7f3

📥 Commits

Reviewing files that changed from the base of the PR and between 96af88d and 557bd78.

📒 Files selected for processing (7)
  • .github/workflows/tests-rs-wallet.yml
  • .github/workflows/tests-rs-workspace.yml
  • packages/rs-platform-wallet-ffi/src/core_wallet_types.rs
  • packages/rs-platform-wallet-ffi/src/persistence.rs
  • packages/rs-platform-wallet/src/wallet/asset_lock/sync/recovery.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/withdrawal.rs
  • packages/wasm-drive-verify/src/state_transition/verify_state_transition_was_executed_with_proof.rs

📝 Walkthrough

Walkthrough

The pull request expands Rust Clippy coverage to all targets and applies equivalent idiomatic updates to wallet FFI, wallet synchronization, withdrawal, and proof verification tests.

Changes

Rust lint and test updates

Layer / File(s) Summary
Expand Clippy target coverage
.github/workflows/tests-rs-wallet.yml, .github/workflows/tests-rs-workspace.yml
Wallet-scoped and workspace Clippy commands now lint all targets, including tests, benches, and examples.
Modernize wallet FFI test fixtures
packages/rs-platform-wallet-ffi/src/core_wallet_types.rs, packages/rs-platform-wallet-ffi/src/persistence.rs
Tests use struct-literal callback fixtures, Default, is_some_and, and contains_key while preserving existing assertions.
Clean up wallet and verification tests
packages/rs-platform-wallet/src/wallet/asset_lock/sync/recovery.rs, packages/rs-platform-wallet/src/wallet/identity/network/withdrawal.rs, packages/wasm-drive-verify/src/state_transition/verify_state_transition_was_executed_with_proof.rs
Tests scope mutex guards, use arrays for fixed key fixtures, and relocate an unchanged alias-identifier rejection test.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • dashpay/platform#4300: Both pull requests modify PersistenceCallbacks tests, while this pull request only refactors test setup.

Suggested reviewers: lklimek, llbartekll, zocolini

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: enabling Clippy linting for all test targets in CI.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ 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 claude/jovial-mclaren-b08db2

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

@thepastaclaw

thepastaclaw commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

🕓 Ready for review — next in queue (commit 557bd78)
Queue position: 1/1 · 2 reviews active
ETA: start ~16:25 UTC · complete ~16:44 UTC (median 19m across 30 recent reviews; 2 slots)
Queued 22m ago · Last checked: 2026-08-07 16:20 UTC

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.61%. Comparing base (963f0d2) to head (557bd78).
⚠️ Report is 1 commits behind head on v4.2-dev.

Additional details and impacted files
@@             Coverage Diff              @@
##           v4.2-dev    #4330      +/-   ##
============================================
- Coverage     87.78%   87.61%   -0.18%     
============================================
  Files          2677     2704      +27     
  Lines        342371   345211    +2840     
============================================
+ Hits         300551   302446    +1895     
- Misses        41820    42765     +945     
Components Coverage Δ
dpp 88.83% <ø> (ø)
drive 86.25% <ø> (ø)
drive-abci 89.66% <ø> (ø)
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.88% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 48.02% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@QuantumExplorer
QuantumExplorer merged commit aced4ce into v4.2-dev Aug 7, 2026
21 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/jovial-mclaren-b08db2 branch August 7, 2026 16: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.

2 participants