Skip to content

feat(quality): lint guardrails, rustfmt baseline, and CI quality gate#222

Merged
vpavlin merged 4 commits into
mainfrom
feat/190-lint-guardrails
Jun 1, 2026
Merged

feat(quality): lint guardrails, rustfmt baseline, and CI quality gate#222
vpavlin merged 4 commits into
mainfrom
feat/190-lint-guardrails

Conversation

@vpavlin

@vpavlin vpavlin commented May 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #190

Summary

  • Workspace lints ([workspace.lints] in root Cargo.toml): unused_must_use and let_underscore_must_use as deny; unwrap_used, expect_used, indexing_slicing as warn; noise reduction with module_name_repetitions = allow, must_use_candidate = allow
  • rustfmt.toml: edition 2021, max_width = 100, Unix newlines, use_field_init_shorthand, use_try_shorthand
  • clippy.toml: msrv = "1.88", test allow-list (allow-unwrap-in-tests, allow-expect-in-tests, etc.), doc-valid-idents for domain terms (SPEL, IDL, FFI, PDA, ...)
  • .github/workflows/quality.yml: three jobs — fmt --check, clippy --all-targets, cargo test; toolchain pinned to 1.88.0 via dtolnay/rust-toolchain in the workflow (no rust-toolchain.toml — that would pin globally and break the existing CI workflow which needs rustc 1.90+ for transitive deps); all member Cargo.toml files get [lints] workspace = true
  • Applied cargo fmt --all (line-length normalisation across the workspace)
  • Applied cargo clippy --fix auto-fixes: uninlined format args, map_or -> is_ok_and, let _ = must_use -> drop() / .ok(), unnecessary qualifications

Known limitation

spel (CLI) and spel-ffi-compile-test are excluded from the clippy and test CI jobs because their transitive deps (logos-blockchain-poq, logos-blockchain-cryptarchia-engine) use unstable features in array lengths, non-const f64::floor) that do not compile on stable 1.88. These crates are excluded via --exclude until upstream fixes land.

Test plan

  • cargo fmt --all --check passes
  • cargo clippy --workspace --all-targets --exclude spel --exclude spel-ffi-compile-test passes (warnings only, no errors)
  • cargo test --workspace --all-targets --exclude spel --exclude spel-ffi-compile-test passes
  • CI quality.yml green on this PR

Generated with Claude Code

@vpavlin vpavlin force-pushed the feat/190-lint-guardrails branch 2 times, most recently from ac92ee1 to 6202381 Compare May 25, 2026 09:33
@vpavlin vpavlin requested a review from Copilot May 26, 2026 11:00
vpavlin and others added 2 commits May 26, 2026 13:23
…gate

Introduces a quality gate that runs on every PR and push to main:

- **Formatting** (`cargo fmt --all --check`) — enforces the rustfmt.toml
  baseline (trailing commas, imports granularity, max width 100).
- **Clippy** — workspace-wide with a clippy.toml (MSRV 1.88, test
  allowances, domain idents). `spel` and `spel-ffi-compile-test` are
  excluded because their transitive deps (`logos-blockchain-poq`,
  `logos-blockchain-cryptarchia-engine`) use unstable features on
  stable 1.88.
- **Unit tests** — same exclusions as clippy.

New files: `.github/workflows/quality.yml`, `clippy.toml`, `rustfmt.toml`

Workspace-level lint config added to every `Cargo.toml`:
  `let_underscore_must_use = "deny"` — forces explicit handling of
  must-use results (fixed two call sites: `drop(attr.parse_nested_meta(…))`
  and `.ok()` on `fs::remove_dir_all`).

All source files re-formatted under the new `rustfmt.toml` baseline
(trailing commas, 100-char width, imports granularity = "module").

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prevents CI from resolving ruint ≥ 1.18.0, which requires rustc 1.90
and breaks the quality gate (pinned to 1.88).

- `Cargo.lock` — workspace lock file (previously gitignored); pins
  ruint to 1.17.0 via `cargo update ruint --precise 1.17.0`.
- `tests/e2e/fixture_program/Cargo.lock` — the fixture program is a
  separate workspace and runs its own dep resolution when e2e tests
  shell out to `cargo build`; committing its lock file prevents it from
  independently picking up ruint 1.18.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vpavlin vpavlin force-pushed the feat/190-lint-guardrails branch from 0ae55d5 to e681260 Compare May 26, 2026 11:24

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI 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.

Pull request overview

Copilot reviewed 47 out of 50 changed files in this pull request and generated 3 comments.

Comment on lines 21 to 27
let ctx2 = ctx; // Copy
let ctx3 = ctx.clone(); // Clone
let ctx3 = ctx; // Clone

Comment thread Cargo.toml
Comment on lines +17 to +20
# Rollout: lints start as `warn` (visible but not blocking).
# Promote to `deny` once the codebase is clean; meanwhile CI runs with
# `-- -D warnings` only on the clean subset (see quality.yml).
# ────────────────────────────────────────────────────────────────────────────
Comment on lines +23 to +28
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.88.0
components: rustfmt
- uses: Swatinem/rust-cache@v2
vpavlin and others added 2 commits June 1, 2026 09:36
- Split test_program_context_clone_copy into two tests: the original had
  `ctx; // Clone` (copy, not a Clone call) — now test_program_context_clone
  explicitly calls `.clone()` and test_program_context_copy tests Copy
- Fix misleading Cargo.toml comment that claimed CI runs with -D warnings;
  currently warnings are collected but not errors (flip noted for later)
- PR description updated to clarify rust-toolchain.toml is absent by design

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The script was removed from the logos-blockchain/logos-blockchain main
branch after the May 25 CI run, causing every job that installs circuits
to fail with "bash: line 1: 404:: command not found".

Pin all 9 occurrences to commit 1da154c7 — the same rev already used by
the workspace's logos-blockchain transitive dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 48 out of 51 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

spel-framework/src/lib.rs:28

  • In prelude, pub use spel_framework_core::prelude::*; already re-exports SpelError, SpelResult, AutoClaim, SpelOutput, and (when the host feature is enabled) Message/WitnessSet. Re-exporting those names again in the same module will fail to compile with E0252 (name defined multiple times). Keep the single glob re-export and only add items not covered by the core prelude.

@vpavlin vpavlin merged commit a2595c0 into main Jun 1, 2026
10 checks passed
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.

Add Rust lint, Clippy, formatting, docs, and dependency guardrails for AI-generated code

2 participants