Repository navigation
chore: adopt workspace lints, declare MSRV, lint Workers crates in CI - #154
Conversation
|
Claude finished @alukach's task in 57s —— View job ✅ No blocking issues — safe to merge. Reviewed the full diff against
Simplify (ponytail) Nothing to flag — this PR is lint/doc/config plumbing with no new abstractions, dependencies, or reinvented logic. The one small addition ( 💰 Estimated review cost: $0.40 · 0m56s · 16 turns |
Preparation for enabling `missing_docs` and `clippy::unwrap_used` at the workspace level. Adds doc comments to the ~90 public fields, variants, and functions that lacked them, and a `# Panics` section on `Router::route`. Remaining `unwrap()` calls outside tests become either a recoverable path (`JwksCache` mutex guards recover from poisoning; the Workers response builder falls back to a 500) or an `expect` whose message states the invariant (response builders fed already-valid status and headers). `OidcBackendAuth::handle` takes the bucket config out of the context instead of re-unwrapping it inside an `if let`. Integration-test crates under `tests/` opt out of the unwrap lint at the crate level; clippy's `allow-unwrap-in-tests` covers only `#[test]` fns and `#[cfg(test)]` modules. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n CI Adds `[workspace.lints]` with `missing_docs` and `clippy::unwrap_used` at warn (CI already runs clippy with `-D warnings`), opted into by every crate with `[lints] workspace = true`. `clippy.toml` exempts tests from the unwrap lint. Declares `rust-version = "1.89"`, the floor imposed by the dependency tree, verified with `cargo +1.89 check`. The Cloudflare crates are excluded from `default-members`, so the native clippy job never linted them. The wasm CI job now runs clippy on them, with a matching `make clippy-wasm` target and a CONTRIBUTING note. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
cbe67b7 to
200a41b
Compare
1ec5d06 to
9a49f02
Compare
|
🚀 Latest commit deployed to https://multistore-proxy-pr-154.development-seed.workers.dev
|
What I'm changing
The workspace had no lint configuration beyond clippy's defaults, no declared minimum Rust version, and no
# Panicsor# Errorsdoc sections anywhere. About 90 public items (mostly struct fields and enum variants intypes.rs,api/response.rs, and the STS response types) had no doc comment, and roughly 15unwrap()calls remained in production paths after #152. Separately, the two Cloudflare Workers crates are excluded fromdefault-members, so the CI clippy job has never linted them.This PR turns on
missing_docsandclippy::unwrap_usedat the workspace level, documents and de-unwraps everything needed to make them clean, declares the MSRV, and adds a wasm clippy step to CI.Stacked on #152 (which removes the header-value unwraps this lint would otherwise flag).
How I did it
Two commits so each is green on its own: the source changes first (inert without the lint), then the configuration that enforces them.
Cargo.toml:[workspace.lints.rust] missing_docs = "warn"and[workspace.lints.clippy] unwrap_used = "warn". CI's-D warningspromotes both to errors.rust-version = "1.89"is the floor set bycrc-fast(viaobject_store); verified locally withcargo +1.89 checkon the native workspace.Cargo.toml:[lints] workspace = true.clippy.toml:allow-unwrap-in-tests = true. This covers#[test]fns and#[cfg(test)]modules but not helper fns intests/*.rsintegration crates, so those three files carry a crate-level#![allow(clippy::unwrap_used)]with a comment saying why.///on each undocumented field, variant, and fn.Router::routegets a# Panicssection (it panics on a conflicting route; previously stated only in prose).Router::new,MaybeSend/MaybeSync,HostStyle,JwksCache,TemporaryCredentialResolver::resolve, and theOidcProviderErrorvariants get real docs.JwksCache(crates/sts/src/jwks.rs): a privatelock()helper recovers from a poisoned mutex viainto_inner(), since the maps only hold cached data.OidcBackendAuth::handle(crates/oidc-provider/src/backend_auth.rs):take()the bucket config out of the context instead ofif let Some(ref ..)followed by.unwrap()on the same field.crates/cf-workers/src/response.rs: response construction falls back to a 500 instead of unwrapping the JS result.sts::matches_glob:parts.last().copied().unwrap_or("").expectwith a message stating that the status and headers came from an already-valid HTTP exchange.examples/cf-workers/src/bandwidth.rs: module-level#![allow(missing_docs)]because the#[durable_object]macro expands to undocumented wasm-bindgen glue that a struct-level allow does not reach.crates/core/src/auth/tests.rs:#[allow(clippy::too_many_arguments)]on the SigV4 test helper, a pre-existing warning that madecargo clippy --all-targetsred..github/workflows/ci.yml: the wasm job now also runscargo clippy -p multistore-cf-workers -p multistore-cf-workers-example --target wasm32-unknown-unknown -- -D warnings.Makefilegainsclippy-wasm(wired intoci-fast) andCONTRIBUTING.mddocuments the lints and MSRV policy.Not changed: the four pre-existing rustdoc warnings from
cargo doc(a private-item link and two unresolved links) are out of scope here.Test plan
cargo clippy -- -D warnings(CI form)cargo clippy --all-targets -- -D warningscargo clippy -p multistore-cf-workers -p multistore-cf-workers-example --target wasm32-unknown-unknown -- -D warningscargo test— 293 passed, 0 failedcargo +1.89 checkon the native workspacecargo fmt --check🤖 Generated with Claude Code