chore: enforce the repository laws mechanically - #24
Merged
Merged
Conversation
Review alone did not keep the rules, so each law now has a check that CI runs (ADR 0013). - `[workspace.lints]` denies the Clippy `all`, `pedantic`, `nursery`, and `cargo` groups, a restriction set taken from domyjob, and the rustc lints Rust 1.75 recognizes. - `clippy.toml` also bans `mem::forget`, `process::exit`, `env::set_var`, and `env::remove_var`, and permits `unwrap`, `expect`, panics, and indexing in tests. - `cargo xtask gates` is a lexer with no dependencies, because `syn` needs `unicode-ident`, whose license `deny.toml` does not allow. It allows only doc and `// SAFETY:` comments, requires every `#[allow]` to be registered with a count and a reason, bans time-named identifiers, delay commands, and bounded `WaitForSingleObject`, and bans `#[default]` and `Box<dyn …>`. `just gates`, `xtask ci`, and the hygiene job run it. Code changes the lints required: - Handle values convert through `sys::handle_value` and `sys::handle_from_value`, the only registered `as` conversions in the library; pointer-integer `From` conversions need Rust 1.84. - Indexing became `get`, arithmetic became checked or saturating, and Win32 lengths convert through `try_from`. - The mitigation enums and `DropPolicy` implement `Default` by hand, so the default is stated instead of implied by declaration order. The public API snapshot shows `default() -> Self`, and `SpawnOptions::parent_process` is now `const`. - `SuspendedChild::id`, `SuspendedChild::as_handle`, and `SpawnTransaction::commit_parts` keep `expect` as registered exceptions: the value owns its process until it is consumed. - Integration tests register `as_conversions`, `expect_used`, and `unwrap_in_result` at the crate level; the probe exits through one registered `process::exit`. - `WAIT_TIMEOUT` is exempt from the time gate: it is what the 0 ms `try_wait` query returns for a running process. - `redundant_pub_crate` is allowed because it contradicts `unreachable_pub`, which the crate keeps. The mutation skips move to the new line numbers of the same code.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 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 |
The first mutation run of this branch left survivors on `?` after conversions and range checks that cannot fail. Each is removed by construction instead of being annotated. - Structure sizes and the maximum path capacity are `DWORD` constants built by `dword_const`, so an oversized value fails the build. - `widen` converts `DWORD` results to `usize`, which has at least 32 bits on every Windows target. - `AttributeList::new` passes the allocation's own size, `drain_output` takes the bytes read, and `split_entry` splits at the separator it found. - `environment_strings` counts with `saturating_add`: an entry lives in memory, so its length cannot reach `usize::MAX`. - `SpawnTransaction::new` sums the attribute count as `u32`. - `create_process` decides the extended startup information once, so the equivalent size and flag mutants collapse into one decision. - `HandleTransfer::lower` no longer checks for a repeated value: every duplicate stays open for the transaction, so values never repeat. - A test holds `DropPolicy::default`, which no test reached. The gate reports registry mismatches without a line number.
No environment block holds an entry without a separator, so only a direct test reaches the None path of split_entry.
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.
Summary
Each repository law now has a check that CI runs (ADR 0013).
[workspace.lints]denies the Clippyall,pedantic,nursery, andcargogroups, a restriction set, and the rustc lints Rust 1.75 recognizes.clippy.tomlbansmem::forget,process::exit,env::set_var, andenv::remove_varin addition to the time APIs.cargo xtask gatesis a lexer with no dependencies.It allows only doc and
// SAFETY:comments, requires every#[allow]to be registered with a count and a reason, bans time-named identifiers, delay commands, and boundedWaitForSingleObject, and bans#[default]andBox<dyn …>.try_fromfor Win32 lengths, and two registeredasconversions for handle values.Public API:
SpawnOptions::parent_processis nowconst, and the hand-writtenDefaultimpls render asdefault() -> Selfin the snapshot.Both are compatible.
Validation
On macOS:
cargo clippy --workspace --all-targets --locked -- -D warningsfor the host,x86_64-pc-windows-msvc,i686-pc-windows-msvc, andaarch64-pc-windows-msvccargo +1.75 check --workspace --all-targets --lockedforx86_64-pc-windows-msvcandi686-pc-windows-msvc, with no warningscargo xtask gates,cargo test -p xtask,cargo fmt --check,cargo docwith-D warningscargo +nightly-2026-07-02 public-api --simplified --target x86_64-pc-windows-msvc, which produced the committed snapshottypos,reuse lint,actionlint,git diff --check,gitleaks dirThe Windows tests run in CI only; the Windows test machine was unreachable.
Checklist
just ciandjust coveragewhen applicable.