Add a lint CI gate (fmt + clippy) - #300
Conversation
.github/workflows/ci.yml already installs rustfmt/clippy components but never runs either — this workspace has had no lint gate at all. Add .github/workflows/lint.yml with a format job (cargo fmt --all --check) and a clippy job (cargo clippy --all-targets -- -D warnings), using actions-rust-lang/setup-rust-toolchain so the pinned version lives in exactly one place (rust-toolchain.toml). Resolve the two clippy::assertions_on_constants findings this surfaces in ogar-dismech: both assertions check DISMECH_CONCEPT_ID against compile-time constant bounds, so the invariant belongs at compile time. Convert each to `const _: () = assert!(...)`, keeping the existing messages verbatim. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AGVLyRZNEKKBSfBDJfbY3V
|
Warning Review limit reachedNext included review available in 53 minutes. View limit detailsLimit details: You’ve used the included review currently available. Your 70 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (3)
Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_21444096-d346-4696-91c3-ec6e88447f3e) |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
.github/workflows/ci.ymlalready installs therustfmt/clippytoolchaincomponents (
dtolnay/rust-toolchain@master), but nothing in that workflowever runs either one — this workspace has had no lint gate at all.
.github/workflows/lint.ymlwith two jobs, bothubuntu-latest,gated on
pull_requestandpushtomain,permissions: contents: read,and a
concurrencygroup that cancels in-progress runs:format:cargo fmt --all --checkclippy:cargo clippy --all-targets -- -D warnings(withSwatinem/rust-cache@v2,timeout-minutes: 30)Both jobs use
actions-rust-lang/setup-rust-toolchain@v1with notoolchain:input — the action readsrust-toolchain.toml, so the pinnedRust version lives in exactly one place.
ci.yml's existing steps untouched, adding only a one-line commentnext to its component install pointing at the new workflow, so it's clear
those components are now actually exercised there rather than dead weight.
cargo clippy -D warningscurrently produces, both
clippy::assertions_on_constantsincrates/ogar-dismech/src/lib.rs(lines 835 and 840): each is a runtimeassert!whose operands (DISMECH_CONCEPT_IDand two literal bounds) areall compile-time constants. Converted both to
const _: () = assert!(...),which checks the identical invariant at compile time instead — the
intent (bounding
DISMECH_CONCEPT_IDclear of two documented bands) isunchanged and both existing assertion messages are kept verbatim. No
#[allow(...)]was used; that would have silenced the lint withoutkeeping the invariant checked.
Only
cargo fmt -p/-p ogar-dismech-scoped commands were run locally(disk-constrained sandbox); the two crate-local gates below are clean, and
the new workflow's own CI run is the verification for the rest of the
workspace:
If the workspace-wide clippy run on this PR's own CI surfaces debt beyond
those two findings, the follow-up is the tiered posture this workspace
already uses elsewhere (
continue-on-error: true+ a named tech-debt line),not a weakening of
-D warnings— flagging that possibility here ratherthan pre-emptively softening the gate.
Supersedes the now-merged PR #299's follow-on lint-gate scope (#299 itself
only bumped the toolchain and has already landed on
main; this PR adds thegate PR #299's own component install implied but never wired up).
Test plan
cargo fmt --all --check— cleancargo check -p ogar-dismech— cleancargo clippy -p ogar-dismech --all-targets -- -D warnings— clean (0 findings, down from 2)cargo test -p ogar-dismech— 20/20 passinglintworkflow run (format + clippy jobs) — theworkspace-wide verification, since a full
--workspaceclippy/fmtrun wasn't run locally due to sandbox disk constraints
🤖 Generated with Claude Code
https://claude.ai/code/session_01AGVLyRZNEKKBSfBDJfbY3V
Generated by Claude Code