fix(ci): make the Rust pipeline deterministic and green - #52
Merged
Conversation
gravity_bench has no rustfmt.toml of its own, so a standalone CI checkout ran `cargo fmt --all -- --check` against rustfmt's *defaults* (91 files non-compliant -> red), while a nested local checkout silently borrowed the parent gravity-sdk rustfmt.toml -> green. The toolchain also floated (dtolnay/rust-toolchain@stable) against the repo's pinned rust-toolchain.toml, and three tests either need a live node or brute-force 1M key derivations, which would hang `cargo test` once fmt was unblocked. - add rustfmt.toml (use_small_heuristics = "Max", etc.) so formatting is self-contained and identical whether checked out standalone (CI) or nested (local); the tree is already compliant, so no reformatting is needed - pin the toolchain to the latest stable 1.95.0 in both rust-toolchain.toml and the workflow (dtolnay/rust-toolchain@1.95.0) -- no more floating @stable - #[ignore] the two node-dependent tests and the 1M-key brute-force lookup; run them on demand with `cargo test -- --ignored` Verified locally under 1.95.0: cargo fmt --check clean, cargo build --release ok, cargo test = 2 passed / 0 failed / 3 ignored. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Rust CI is red on
mainand on PRs (e.g. #50). TheCheckjob fails at thefmt step, which blocks
Build(needs: check).The failure was confusing because
cargo fmt --all -- --checkpasses locallybut fails in CI. Root cause:
gravity_benchships norustfmt.tomlof itsown.
rustfmtfalls back to itsdefaults → 91 files are reported non-compliant → fmt fails.
gravity-sdkmonorepo, sorustfmtwalks up and silently uses the parent
gravity-sdk/rustfmt.toml(
use_small_heuristics = "Max", …) → the same tree looks clean.Two more problems were latent behind the fmt failure (they only surface once
fmt is unblocked, so CI never reached them):
dtolnay/rust-toolchain@stablewhile the repo pins
1.91.0viarust-toolchain.toml— non-deterministic(a new stable release silently changes formatter/lints).
cargo test --all-featuresin CI: two#[tokio::test]s require a live node atlocalhost:8545, andtest_find_account_by_addressbrute-forces 1,000,000 key derivations(observed running >60 s) for a target address not in range.
Fix
rustfmt.toml(use_small_heuristics = "Max",reorder_imports,use_field_init_shorthand)1.95.0inrust-toolchain.tomland the workflow (dtolnay/rust-toolchain@1.95.0, both jobs)@stable.#[ignore]the 2 node-dependent tests + the 1M-key brute-force lookupcargo test -- --ignored.Verification (locally, toolchain
1.95.0)cargo check --all-targets --all-featuresalso passes — so all four CI steps(fmt → check → test → build) are green.
🤖 Generated with Claude Code