mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #388] chore: enforce workspace clippy lints #397
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#397
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/388
Author: @yingdi-shan
Created: 10/16/2026
Status: 🔄 Open
Base:
main← Head:chore/clippy-workspace-lints📝 Commits (2)
784d88cchore: enforce workspace clippy lints1afc6fechore: forbid expect in production code and trim noisy lints📊 Changes
150 files changed (+1564 additions, -1202 deletions)
View changed files
📝
Cargo.toml(+47 -0)📝
adev/Cargo.toml(+3 -0)📝
adev/src/codegen.rs(+12 -17)📝
adev/src/coverage.rs(+6 -8)📝
adev/src/ensure_tool.rs(+5 -6)📝
adev/src/util.rs(+1 -2)📝
build.rs(+4 -5)➕
clippy.toml(+6 -0)📝
crates/aenv/Cargo.toml(+3 -0)📝
crates/aenv/src/client/buildkit.rs(+2 -2)📝
crates/aenv/src/commands/build.rs(+1 -1)📝
crates/aenv/src/commands/codex/guest.rs(+6 -3)📝
crates/aenv/src/commands/codex/project.rs(+1 -1)📝
crates/aenv/src/commands/codex/runtime.rs(+28 -13)📝
crates/aenv/src/commands/codex/socket.rs(+16 -9)📝
crates/aenv/src/commands/completion.rs(+1 -1)📝
crates/aenv/src/commands/connect.rs(+8 -4)📝
crates/aenv/src/commands/pull.rs(+3 -3)📝
crates/aenv/src/commands/upload.rs(+1 -1)📝
crates/benchmarks/Cargo.toml(+3 -0)...and 80 more files
📄 Description
What
Adds a
[workspace.lints.clippy]table with 42 clippy lints, opts every handwritten crate into it, and fixes or explicitly suppresses every hit. Generated crates (agentenv_http_server,custom_extension_client,firecracker_client) stay opted out because codegen would overwrite their manifests. Becausemake clippyruns with-D warnings, the lints are enforced in CI.How the lints were chosen:
large_futures,unused_async,assigning_clones,ref_option,implicit_cloneandcloned_instead_of_copied.too_many_lines: threshold 150, set inclippy.toml. The 16 existing long functions have#[allow], so only new long functions are rejected.unwrap_usedandexpect_used: production code may neither unwrap nor expect.allow-unwrap-in-testsandallow-expect-in-testsare set. Bench, example and integration-test helper files outsidecfg(test)have a file-level allow.Excluded after measurement because they produced false positives here or are nursery lints with known false positives:
branches_sharing_code,collection_is_never_read,create_dir,duration_suboptimal_units,mutex_atomic,needless_pass_by_ref_mut,set_contains_or_insert,trait_duplication_in_bounds,unnecessary_wrapsandunused_self.Why
These lints catch real problems the default set misses:
unwrap,expect,todo, unchecked time subtraction)asyncfunctions that never awaitArc<Vec<_>>patternsReplacing
unwrap()withexpect()only renames the panic, soexpect_usedis enforced too.Related issue
None. Tooling and cleanup change.
Scope and non-goals
Cargo.tomllint tables,clippy.toml, and the code changes needed to satisfy the lints, including test code, which the lints also cover.needless_pass_by_value(37 hits),cast_lossless(47), thecast_*family (200+),missing_errors_docandmust_use_candidate.panicandindexing_slicingare also not enabled.Design and behavior changes
lock()/read()/write()/Condvar::wait/get_mutresults recover the guard withunwrap_or_else(|poisoned| poisoned.into_inner()), matching existing code inresolver.rsandstartup_pack.rs.expects:?(fixed-size header parsing, the zstd contexts, the ublk and ublk-daemon binaries, the CLI commands).let … else, iterating pairs instead of re-looking up keys, deriving VM/TAP IPs inNetworkAddressPlan::from_config, keeping a pre-keyed HMAC, storingCommittedSnapshotdirectly inRunnableSnapshot).IndexLBPT::newon an empty mapping.pack_planner::stage_blockwith more than 65,536 objects.Slot::newfailures in the network manager, which also free the slot bit now.expects: 12 sites carry#[expect(clippy::expect_used, reason = …)]:ConfigManager,UblkDeviceManager,NetworkManager)deps_manifest.toml×3, now each covered by a parse testunused_async: functions with no.awaitare no longerasync, and callers are updated (see Compatibility).large_futures: futures over 16 KiB are boxed withBox::pinat their await sites.OkorSomenow return the value directly (for exampleArtifactCache::evict_lru, thesetup/packages.rshelpers and two ublk-daemon handlers). Methods that never usedselfbecame associated functions. A few&mutparameters became&.take().HashMap::extract_if.Arc<Vec<PathBuf>>becomesArc<[PathBuf]>.deps/mod.rsandsandbox/envd.rsnow usePath::extension()and compare case-insensitively.RegistryFsV2::new()andimpl Default for RegistryFsV2, which had no callers and panicked on failure.Compatibility and operations
async fn→fn:overlaybd::ImageService::{new, from_config_path, from_config_path_with_p2p_publish_url}VolumeManager::{open_with_repository, open_with_repository_and_limits}io_bufferconstructorsResult:IndexLBPT::newUserBuffer::uring_buf_idx/IOBuffer::uring_buf_idx(io::Result<u16>)Orchestrator::with_in_memory_storeRegistryFsV2::new/Default.HashMap::extract_if; the toolchain is stable.Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons:
tests/integration/*,make test-agent-integration): not run. The changes there are signature-only or test-helper changes, and they compile under clippy.services/: unchanged.Risks and reviewer notes
NetworkAddressPlanderivation failing now denies all egress instead of panicking. Startup already validates the same config, so this should not happen in practice.async fns did no awaiting, so whatever blocking they did already happened on the executor thread; making them sync changes nothing at runtime.Box::pin: adds one heap allocation per affected call, all on control-plane or test paths.clippy --fixoutput was reviewed, and the poor rewrites were changed back.Checklist
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.