feat(governance): Clippy lint policy scaffolding (PR 1 of stack)#3710
feat(governance): Clippy lint policy scaffolding (PR 1 of stack)#3710EffortlessSteven wants to merge 1 commit intomainfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a lint governance framework for the bitnet-rs workspace, including a formal policy document and TOML ledgers for tracking lints, technical debt, and allowlists. It also adds an xtask command to verify policy consistency. Feedback highlights that the new xtask implementation is missing required imports for the chrono and toml crates, which will lead to compilation errors.
| use std::collections::BTreeSet; | ||
| use std::fs; | ||
| use std::path::{Path, PathBuf}; | ||
|
|
||
| use anyhow::{Context, Result, bail}; | ||
| use serde::Deserialize; |
There was a problem hiding this comment.
The chrono and toml crates are used in this file but are not imported. Please add the necessary imports to ensure the code compiles.
| use std::collections::BTreeSet; | |
| use std::fs; | |
| use std::path::{Path, PathBuf}; | |
| use anyhow::{Context, Result, bail}; | |
| use serde::Deserialize; | |
| use std::collections::BTreeSet; | |
| use std::fs; | |
| use std::path::{Path, PathBuf}; | |
| use anyhow::{Context, Result, bail}; | |
| use chrono::{NaiveDate, Utc}; | |
| use serde::Deserialize; | |
| use toml; |
Introduce the workspace lint governance ledger and a `cargo xtask
check-lint-policy` subcommand without changing any actual lint behaviour.
This is the base of a stacked rollout described in docs/CLIPPY_POLICY.md.
policy/clippy-lints.toml active baseline + planned 1.94/1.95 flips
policy/clippy-debt.toml seed for tracked exceptions (owner+expiry)
policy/no-panic-allowlist.toml semantic schema (path + family + selector)
policy/non-rust-allowlist.toml TOML migration of non-Rust file policy
docs/CLIPPY_POLICY.md policy doc, suppression style, rollout plan
xtask/src/lint_policy.rs check-lint-policy implementation
The new subcommand is advisory by default and can be promoted to a CI
gate with --strict once PR 2 (strict baseline) lands. It currently
verifies:
- schema versions of all four policy files
- MSRV agreement between policy/clippy-lints.toml,
workspace.package.rust-version, and rust-toolchain.toml channel
- planned-lint MSRV is current or future, never past
- debt entries have owner / reason / lint / expiry and are not expired
- lint names use a recognised root prefix (clippy::, rust::, ...)
No production crate or CI workflow is touched.
https://claude.ai/code/session_01B5tBepFTH4UCnpBqXGt4CC
e8f1313 to
39af58c
Compare
Summary
Base of a stacked rollout that turns Clippy into a governed engineering surface rather than ad-hoc settings in
Cargo.toml. No lint behaviour changes in this PR — only policy infrastructure.policy/clippy-lints.toml— machine-readable ledger of active lints + planned Rust 1.94/1.95 flip cohortspolicy/clippy-debt.toml— seed for tracked exceptions (owner / reason / lint /expires)policy/no-panic-allowlist.toml— semantic schema (path + family + selector) ported from theriprv0.2 modelpolicy/non-rust-allowlist.toml— TOML migration of the prior pipe-delimited non-Rust file policydocs/CLIPPY_POLICY.md— policy doc, suppression style (#[expect(..., reason = "...")]), BitNet-rs overlay, rollout schedulecargo xtask check-lint-policy— advisory by default,--strictavailable for CI once PR 2 landsWhat the checker verifies today
policy/*.tomlfiles.policy/clippy-lints.toml,workspace.package.rust-version, andrust-toolchain.tomlchannel.owner/reason/lint/expires, expiry is parseable, and not in the past.clippy::,rust::,rustc::,rustdoc::).It deliberately does not yet:
xtask check-no-panic-family).xtask check-file-policy).policy/clippy-lints.tomlagainst[workspace.lints]— that lands with PR 2 when the strict block is applied.Stack plan
claude/clippy-governance-system-HERR6(this)claude/clippy-strict-baseline-...all/pedantic/nurserywith explicit lint set; removeallow-unwrap-in-tests/allow-expect-in-testsfromclippy.toml; seedpolicy/clippy-debt.tomlwith the resulting violations (named owner + ≤90-day expiry); promotextask check-lint-policyto CI gate.claude/clippy-msrv-1.93-...rust-toolchain.toml,workspace.package.rust-version, andpolicy/clippy-lints.toml. Promotewarnnumeric lints →denyper crate.claude/clippy-1.94-cohort-...etc.activate_when_msrv = "1.94"/"1.95"cohorts when MSRV reaches each.BitNet-rs overlay (encoded in
policy/clippy-lints.toml)denyat PR 2.unsafe_code→forbid, with a documented exception list for GPU backend crates (bitnet-kernels,bitnet-rocm,bitnet-cuda*,bitnet-metal,bitnet-vulkan,bitnet-opencl,bitnet-wgpu).cast_*,float_cmp) start atwarn;arithmetic_side_effectsstayswarnindefinitely until kernel debt is triaged.allow-unwrap-in-testsetc.) currently inclippy.toml→ flagged asinfotoday, scheduled for removal in PR 2.Test plan
cargo build --locked -p xtask --no-default-features— clean buildcargo clippy --locked -p xtask --no-default-features --bin xtask --all-targets -- -D warnings— cleancargo fmt --all -- --check— cleancargo test --locked -p xtask --no-default-features --bin xtask lint_policy::— 2 passedcargo run --locked -p xtask --no-default-features -- check-lint-policy—1 info, 0 warnings, 0 errorscargo run --locked -p xtask --no-default-features -- check-lint-policy --strict— exit 0clippy-debt.tomlWhy review this in isolation
PR 2 will produce a large set of debt entries when it removes the
pedantic/nurserywarn block in favour of the explicit list and drops the test carveouts. Landing the schema, doc, and checker first means PR 2's diff is "applied lint policy + reviewed debt list" rather than "lots of new files mixed with lint changes."https://claude.ai/code/session_01B5tBepFTH4UCnpBqXGt4CC
Generated by Claude Code